I am bit confused about "best practice" controller using question.
My typically code look
public ActionResult Edit(int reportId,FormCollection formCollection)
{
try
{
var report = _dbContext.EmployeeReports.Find(reportId);
if (TryUpdateModel(report))
{
_employeeReportService.Update(report);
return RedirectToAction("List");
}
return View("Edit", report);
}
catch (Exception)
{
// some logging etc
return RedirectToAction("List");
}
Well, is better using "TryUpdateModel" or only "UpdateModel" or simple call Model.IsValid and is good idea to catch exception in controller?
Thanks