public ActionResult Add(RendCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRend Controller Begin")); try { // Add add logic here if (ModelState.IsValid) { var committed = _serviceRend.Insert(model.Rend, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRend Controller End")); return(RedirectToAction("Add")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRend Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("RendAddView", new RendCrudViewModel(_serviceRend, _serviceRendCant))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRend Controller Begin")); try { // Add add logic here var model = new RendCrudViewModel(_serviceRend, _serviceRendCant); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRend Controller End")); return(View("RendAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddRend Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveRend Controller Begin")); try { // Add remove logic here var model = new RendCrudViewModel(_serviceRend, _serviceRendCant) { Rend = _serviceRend.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveRend Controller End")); return(View("RendRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveRend Controller ERROR"), ex); } return(RedirectToAction("Find")); }