public ActionResult Modify(DesCantCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyDesCant Controller Begin")); try { // Add modify logic here if (ModelState.IsValid) { var committed = _serviceDesCant.Update(model.DesCant, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyDesCant Controller End")); return(RedirectToAction("Find")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyDesCant Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("DesCantModifyView", new DesCantCrudViewModel(_serviceDesCant, _serviceAlim, _serviceDesecho))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddDesCant Controller Begin")); try { // Add add logic here var model = new DesCantCrudViewModel(_serviceDesCant, _serviceAlim, _serviceDesecho); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddDesCant Controller End")); return(View("DesCantAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddDesCant Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveDesCant Controller Begin")); try { // Add remove logic here var model = new DesCantCrudViewModel(_serviceDesCant, _serviceAlim, _serviceDesecho) { DesCant = _serviceDesCant.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveDesCant Controller End")); return(View("DesCantRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveDesCant Controller ERROR"), ex); } return(RedirectToAction("Find")); }