public ActionResult Edit(ColorFormModel ColorVM) { if (ModelState.IsValid) { Color Color = new Color(); Color.Id = ColorVM.Id; Color.Codigo = ColorVM.Codigo; Color.Descripcion = ColorVM.Descripcion; colorService.Update(Color); return(Json(new { data = true }, JsonRequestBehavior.AllowGet)); } return(Json(new { data = false }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(ColorFormModel ColorVM) { if (ModelState.IsValid) { Color Color; Color = new Color(); Color.Id = Guid.NewGuid(); Color.Codigo = colorRepository.MaxCodigo(); Color.Descripcion = ColorVM.Descripcion; colorService.Add(Color); return(Json(new { success = true })); } return(Json(ColorVM, JsonRequestBehavior.AllowGet)); }
public ActionResult ValidationDeleteColor(Guid id) { Color Color = colorService.GetColor(id); if (Color == null) { return(HttpNotFound()); } var deleteVM = new ColorFormModel(); deleteVM.Id = Color.Id; ViewBag.Message = "No es posible eliminar dicho color porque tiene clases asociadas."; return(PartialView("_Validation", deleteVM)); }
public ActionResult ConfirmDelete(Guid id) { Color Color = colorService.GetColor(id); if (Color == null) { return(HttpNotFound()); } var deleteVM = new ColorFormModel(); deleteVM.Id = Color.Id; ViewBag.Message = "Confirma que desea realizar esta operaciĆ³n?"; return(PartialView("_Delete", deleteVM)); }
public ActionResult Edit(Guid id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Color Color = colorService.GetColor(id); if (Color == null) { return(HttpNotFound()); } var editVM = new ColorFormModel(); editVM.Id = Color.Id; editVM.Codigo = Color.Codigo; editVM.Descripcion = Color.Descripcion; return(PartialView(editVM)); }
public ActionResult Create() { var ColorVM = new ColorFormModel(); return(PartialView(ColorVM)); }