public ActionResult Modify(RecProdCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyRecProd Controller Begin")); try { // Add modify logic here if (ModelState.IsValid) { var committed = _serviceRecProd.Update(model.RecProd, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyRecProd Controller End")); return(RedirectToAction("Find")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyRecProd Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("RecProdModifyView", new RecProdCrudViewModel(_serviceRecProd, _serviceAlim, _serviceReceta))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRecProd Controller Begin")); try { // Add add logic here var model = new RecProdCrudViewModel(_serviceRecProd, _serviceAlim, _serviceReceta); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRecProd Controller End")); return(View("RecProdAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRecProd Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveRecProd Controller Begin")); try { // Add remove logic here var model = new RecProdCrudViewModel(_serviceRecProd, _serviceAlim, _serviceReceta) { RecProd = _serviceRecProd.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveRecProd Controller End")); return(View("RecProdRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveRecProd Controller ERROR"), ex); } return(RedirectToAction("Find")); }