public ActionResult Detail(Service service) { if (!ModelState.IsValid) { var model = new ServiceModel() { Service = service, ServiceTypes = EnumCollection.GetServiceTypeEnum() }; return(View(model)); } var result = ServiceTypeService.Save(service); if (result.HasError) { ViewBag.Error = result.Message; var model = new ServiceModel() { Service = service, ServiceTypes = EnumCollection.GetServiceTypeEnum() }; return(View(model)); } return(RedirectToAction("List")); }
public ActionResult Detail(int id) { var result = ServiceTypeService.GetByID(id); var model = new ServiceModel() { Service = result.Data ?? new Service(), ServiceTypes = EnumCollection.GetServiceTypeEnum() }; return(View(model)); }