public ActionResult Add(Alim_FuenteCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddAlim_Fuente Controller Begin")); try { // Add add logic here if (ModelState.IsValid) { var committed = _serviceAlim_Fuente.Insert(model.Alim_Fuente, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddAlim_Fuente Controller End")); return(RedirectToAction("Add")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddAlim_Fuente Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("Alim_FuenteAddView", new Alim_FuenteCrudViewModel(_serviceAlim_Fuente, _serviceAlim))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddAlim_Fuente Controller Begin")); try { // Add add logic here var model = new Alim_FuenteCrudViewModel(_serviceAlim_Fuente, _serviceAlim); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddAlim_Fuente Controller End")); return(View("Alim_FuenteAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddAlim_Fuente Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveAlim_Fuente Controller Begin")); try { // Add remove logic here var model = new Alim_FuenteCrudViewModel(_serviceAlim_Fuente, _serviceAlim) { Alim_Fuente = _serviceAlim_Fuente.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveAlim_Fuente Controller End")); return(View("Alim_FuenteRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveAlim_Fuente Controller ERROR"), ex); } return(RedirectToAction("Find")); }