コード例 #1
0
 public ActionResult Create(Especie model)
 {
     try
     {
         _especieService.Agregar(model);
         TempData[Application.MessageViewBagName] = new GenericMessageViewModel
         {
             Message     = "Registro agregado a la base de datos.",
             MessageType = GenericMessages.success
         };
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         var err = $"No se puede agregar el registro: {ex.Message}";
         TempData[Application.MessageViewBagName] = new GenericMessageViewModel
         {
             Message     = err,
             MessageType = GenericMessages.danger
         };
         return(View());
     }
 }