public IActionResult CreateType(VehicleType type) { if (ModelState.IsValid) { repo.Create(type); return(RedirectToAction("ViewVehicleTypes")); } return(View("CreateType")); }
public ActionResult Create(VehicleType model) { ViewBag.Head = "Manage Vehicle Type"; ViewBag.Form = "Vehicle Type Registration"; if (ModelState.IsValid) { try { _rep.Create(model); } catch (Exception) { throw; } return(RedirectToAction("Index")); } else { return(View(model)); } }