Пример #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var buCategoriaComponente = new BuCategoriaComponente();
            var categoriaComponente   = buCategoriaComponente.GetById(id.Value);

            if (categoriaComponente == null)
            {
                return(HttpNotFound());
            }

            return(View(categoriaComponente));
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            var buCategoriaComponente = new BuCategoriaComponente();
            var categoriaComponente   = buCategoriaComponente.GetById(id);

            if (categoriaComponente == null)
            {
                return(HttpNotFound());
            }
            try
            {
                buCategoriaComponente.Delete(id);
                TempData["Message"] = "Message: La operación se realizó satisfactoriamente.";
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                ViewBag.ErrorMessage = $"Error Message: {e.Message}";
            }

            return(View(categoriaComponente));
        }