public ActionResult Add(LoginAttemptsCrudViewModel model) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLoginAttempts Controller Begin")); try { // Add add logic here if (ModelState.IsValid) { var committed = _serviceLoginAttempts.Insert(model.LoginAttempts, null); _unitOfWork.SaveChanges(); if (committed) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLoginAttempts Controller End")); return(RedirectToAction("Add")); } } } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLoginAttempts Controller ERROR"), ex); } ModelState.AddModelError("", PresentationResources.Error); return(View("LoginAttemptsAddView", new LoginAttemptsCrudViewModel(_serviceLoginAttempts, _serviceUsuario))); }
// GET public ActionResult Add() { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLoginAttempts Controller Begin")); try { // Add add logic here var model = new LoginAttemptsCrudViewModel(_serviceLoginAttempts, _serviceUsuario); //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLoginAttempts Controller End")); return(View("LoginAttemptsAddView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLoginAttempts Controller ERROR"), ex); } return(RedirectToAction("Index", "Home")); }
// GET public ActionResult Remove(int id) { //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveLoginAttempts Controller Begin")); try { // Add remove logic here var model = new LoginAttemptsCrudViewModel(_serviceLoginAttempts, _serviceUsuario) { LoginAttempts = _serviceLoginAttempts.Find(id) }; //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveLoginAttempts Controller End")); return(View("LoginAttemptsRemoveView", model)); } catch (Exception ex) { //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveLoginAttempts Controller ERROR"), ex); } return(RedirectToAction("Find")); }