Exemplo n.º 1
0
        public ActionResult Eliminar(int id)
        {
            var perfil = _perfilManager.Find(id);

            if (perfil == null)
            {
                TempData["FlashError"] = CommonMensajesResource.ERROR_PerfilProveedor_PefilIdIncorrecto;
                return(RedirectToAction("Index"));
            }

            try
            {
                _perfilManager.Eliminar(id);
                TempData["FlashSuccess"] = CommonMensajesResource.INFO_PerfilProveedor_EliminadoCorrectamente;
                return(RedirectToAction("Index"));
            }
            catch (BusinessException businessEx)
            {
                TempData["FlashError"] = businessEx.Message;
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                var log = CommonManager.BuildMessageLog(
                    TipoMensaje.Error,
                    ControllerContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString(),
                    ControllerContext.Controller.ValueProvider.GetValue("action").RawValue.ToString(),
                    e.ToString(), Request);

                CommonManager.WriteAppLog(log, TipoMensaje.Error);

                TempData["FlashError"] = CommonMensajesResource.ERROR_General;
                return(RedirectToAction("Index"));
            }
        }