This error is thrown when I try to edit my post.
Here is my code:
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
return NotFound();
}
// issue
var news = await _context.News.FindAsync(id);
if (news == null)
{
return NotFound();
}
return View(news);
}
The debugger stops the code at
var news = await _context.News.FindAsync(id);
Code for my model is
public int id { get; set; }
[Required(ErrorMessage = "Enter your name.")]
public string Author { get; set; }
[Required(ErrorMessage = "Enter the title.")]
public string Title { get; set; }
[Required(ErrorMessage = "Enter the issued date.")]
[DataType(DataType.Date)]
public DateTime IssueDate { get; set; }
[Required(ErrorMessage = "Enter a message.")]
[DataType(DataType.MultilineText)]
public string Body { get; set; }
Any idea on how to fix this?