public ActionResult Modify(UserPhotosCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyUserPhotos Controller Begin")); try { // Add modify logic here if (ModelState.IsValid) { var committed = _serviceUserPhotos.Update(model.UserPhotos, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyUserPhotos Controller End")); return(RedirectToAction("Find")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyUserPhotos Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("UserPhotosModifyView", new UserPhotosCrudViewModel(_serviceUserPhotos, _serviceImagenes, _serviceUsuario))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUserPhotos Controller Begin")); try { // Add add logic here var model = new UserPhotosCrudViewModel(_serviceUserPhotos, _serviceImagenes, _serviceUsuario); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUserPhotos Controller End")); return(View("UserPhotosAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUserPhotos Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveUserPhotos Controller Begin")); try { // Add remove logic here var model = new UserPhotosCrudViewModel(_serviceUserPhotos, _serviceImagenes, _serviceUsuario) { UserPhotos = _serviceUserPhotos.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveUserPhotos Controller End")); return(View("UserPhotosRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveUserPhotos Controller ERROR"), ex); } return(RedirectToAction("Find")); }