public ActionResult Modify(RecetaCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyReceta Controller Begin")); try { // Add modify logic here if (ModelState.IsValid) { var committed = _serviceReceta.Update(model.Receta, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyReceta Controller End")); return(RedirectToAction("Find")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyReceta Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("RecetaModifyView", new RecetaCrudViewModel(_serviceReceta, _serviceFamRec, _serviceRecProd))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddReceta Controller Begin")); try { // Add add logic here var model = new RecetaCrudViewModel(_serviceReceta, _serviceFamRec, _serviceRecProd); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddReceta Controller End")); return(View("RecetaAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddReceta Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveReceta Controller Begin")); try { // Add remove logic here var model = new RecetaCrudViewModel(_serviceReceta, _serviceFamRec, _serviceRecProd) { Receta = _serviceReceta.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveReceta Controller End")); return(View("RecetaRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveReceta Controller ERROR"), ex); } return(RedirectToAction("Find")); }