public ActionResult Edit(Guid id, StandardForm standardForm) { if (!ModelState.IsValid) { return(View(standardForm)); } var available = _standardService.IsNameAvailable(standardForm.Name, id); if (!available) { return(View(standardForm).WithError("Ya existe un estandar con el nombre ingresado.")); } _standardService.Edit(standardForm.ToStandard()); return(RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar editado")); }
public ActionResult Create(StandardForm standardForm) { if (!ModelState.IsValid) { return View(standardForm); } var available = _standardService.IsNameAvailable(standardForm.Name, Guid.Empty); if (!available) { return View(standardForm).WithError("Ya existe una standard con el nombre ingresado."); } var standard = standardForm.ToStandard(); _standardService.Create(standard); return RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar creado"); }
public ActionResult Create(StandardForm standardForm) { if (!ModelState.IsValid) { return(View(standardForm)); } var available = _standardService.IsNameAvailable(standardForm.Name, Guid.Empty); if (!available) { return(View(standardForm).WithError("Ya existe una standard con el nombre ingresado.")); } var standard = standardForm.ToStandard(); _standardService.Create(standard); return(RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar creado")); }
public ActionResult Edit(Guid id, StandardForm standardForm) { if (!ModelState.IsValid) { return View(standardForm); } var available = _standardService.IsNameAvailable(standardForm.Name, id); if (!available) { return View(standardForm).WithError("Ya existe un estandar con el nombre ingresado."); } _standardService.Edit(standardForm.ToStandard()); return RedirectToAction("Index", new StandardListFiltersModel().GetRouteValues()).WithSuccess("Estandar editado"); }