public ActionResult Edit(Guid id, VehicleMakePoco model) { try { if (!ModelState.IsValid) { return View(model); } // Calls a method for updating an existing make. vehicleMakeService.Update(id, model); return RedirectToAction("index"); } catch (Exception) { ModelState.AddModelError("", "Unable to save changes, please try again"); return View(model); } }
public ActionResult Create(VehicleMakePoco model) { if (!ModelState.IsValid) { return View(model); } try { // Calls the method for creating new make; vehicleMakeService.Create(model); return RedirectToAction("index"); } catch (Exception) { ModelState.AddModelError("", "Unable to save changes, please try again"); return View(model); } }