示例#1
0
 public T GetById(Guid Id)
 {
     try
     {
         return(db.Set <T>().Find(Id));
     }
     catch (Exception ex)
     {
         errorService.SaveError(ex);
         return(null);
     }
 }
示例#2
0
        public bool Verify(RegisterViewModel model)
        {
            try
            {
                using (db = new PMSContext())
                {
                    security = new SecurityServices();
                    string pass = security.Encrypt(model.password, true);

                    var user = db.PMSuser.Where(x => (x.UserName == model.user || x.Email == model.user || x.Phone == model.user) && x.Password == pass && !x.IsDeleted).FirstOrDefault();
                    if (user != null)
                    {
                        AddCookie(user);
                        return(true);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errorService.SaveError(ex);
                return(false);
            }
        }