Why do I get an error and i have also post the code of get method of controller and please check my code is there any error??
public IActionResult upsert(int? id)
{
ProductVM productVM = new ProductVM();
{
Product product = new Product();
FlavourSelectList = _db.Flavour.Select(i => new SelectListItem
{
Text = i.name,
Value = i.id.ToString()
});
}
if (id==null)
{
return View(productVM);
}
else
{
productVM.Product = _db.Product.Find(id);
if(productVM.Product == null)
{
return NotFound();
}
return View(productVM);
}
}