Beispiel #1
0
        public ActionResult Create(PETiano petiano)
        {
            petiano.Password = Crypto.HashPassword(petiano.Password);
            _PETianoService.CreatePETiano(petiano);

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 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));
     }
 }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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());
            }
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
 public void DeletePETiano(PETiano petiano)
 {
     using (IDataProvider provider = base.CreateDataProvider())
         using (IPETianoRepository repository = provider.CreatePETianoRepository())
             repository.Delete(petiano);
 }
Beispiel #7
0
 public void DeletePETiano(PETiano petiano)
 {
     using (IBusinessProvider provider = base.CreateBusinessProvider())
         using (IPETianoBusinessProvider prov = provider.CreatePETianoBusinessProvider())
             prov.DeletePETiano(petiano);
 }
Beispiel #8
0
        public ActionResult Delete(PETiano petiano)
        {
            _PETianoService.DeletePETiano(petiano);

            return(RedirectToAction("Index"));
        }