コード例 #1
0
        public List <PETiano> GetPETianos(PETianoFilter petianoFilter = null)
        {
            if (petianoFilter == null)
            {
                petianoFilter = new PETianoFilter();
            }

            return(_Context.PETianos
                   .ToList());
        }
コード例 #2
0
        public PETiano GetPETiano(PETianoFilter petianoFilter = null)
        {
            if (petianoFilter == null)
            {
                petianoFilter = new PETianoFilter();
            }

            return(_Context.PETianos
                   .Where(y => petianoFilter.Login == null || y.Login.Equals(petianoFilter.Login))
                   .FirstOrDefault());
        }
コード例 #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);
            }
        }
コード例 #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());
            }
        }
コード例 #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));
        }
コード例 #6
0
 public List <PETiano> GetPETianos(PETianoFilter petianoFilter = null)
 {
     using (IDataProvider provider = base.CreateDataProvider())
         using (IPETianoRepository repository = provider.CreatePETianoRepository())
             return(repository.GetPETianos(petianoFilter));
 }
コード例 #7
0
 public List <PETiano> GetPETianos(PETianoFilter petianoFilter = null)
 {
     using (IBusinessProvider provider = base.CreateBusinessProvider())
         using (IPETianoBusinessProvider prov = provider.CreatePETianoBusinessProvider())
             return(prov.GetPETianos(petianoFilter));
 }