public ActionResult Create(PETiano petiano) { petiano.Password = Crypto.HashPassword(petiano.Password); _PETianoService.CreatePETiano(petiano); return(RedirectToAction("Index")); }
public ActionResult Index(PETiano user) { if (_IsValid(user.Login, user.Password)) { FormsAuthentication.SetAuthCookie(user.Login, false); return(RedirectToAction("Index", "PETiano")); } else { ViewData[Localization.Global.Error.LoginFail] = Localization.Global.Error.LoginFail; return(View(user)); } }
private bool _IsValid(string login, string password) { PETianoFilter petianoFilter = new PETianoFilter() { Login = login }; PETiano user = _PETianoService.GetPETiano(petianoFilter); if (user != null && Crypto.VerifyHashedPassword(user.Password, password)) { return(true); } else { return(false); } }
public ActionResult Delete(int id) { PETianoFilter petianoFilter = new PETianoFilter() { Id = id }; PETiano petiano = _PETianoService.GetPETiano(petianoFilter); if (petiano != null) { return(View(petiano)); } else { return(View()); } }
public ActionResult Edit(int id) { PETianoFilter petianoFilter = new PETianoFilter() { Id = id }; PETiano petiano = _PETianoService.GetPETiano(petianoFilter); petiano.Password = Crypto.Hash(petiano.Password); if (petiano == null) { return(View()); } return(View(petiano)); }
public void DeletePETiano(PETiano petiano) { using (IDataProvider provider = base.CreateDataProvider()) using (IPETianoRepository repository = provider.CreatePETianoRepository()) repository.Delete(petiano); }
public void DeletePETiano(PETiano petiano) { using (IBusinessProvider provider = base.CreateBusinessProvider()) using (IPETianoBusinessProvider prov = provider.CreatePETianoBusinessProvider()) prov.DeletePETiano(petiano); }
public ActionResult Delete(PETiano petiano) { _PETianoService.DeletePETiano(petiano); return(RedirectToAction("Index")); }