Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }
Example #6
0
        public ActionResult Create()
        {
            var ColorVM = new ColorFormModel();

            return(PartialView(ColorVM));
        }