Beispiel #1
0
        // ClientService
        public bool AddClient(User user)
        {
            var encriptionMd5 = Encription.MD5Hash(user.Password);

            user.Password = encriptionMd5;
            db.User.InsertOnSubmit(user);
            db.SubmitChanges();
            return(true);
        }
Beispiel #2
0
        public bool LoginClient(User user)
        {
            var result = db.User.Where(x => x.Email == user.Email && x.Password == Encription.MD5Hash(user.Password)).FirstOrDefault();

            if (result == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public bool LoginAdmin(Admin admin)
        {
            var result = db.Admin.Where(x => x.Email == admin.Email && x.Password == Encription.MD5Hash(admin.Password)).FirstOrDefault();

            if (result == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
 // AdminService
 public bool AddAdmin(Admin admin)
 {
     try
     {
         var encriptionMd5 = Encription.MD5Hash(admin.Password);
         admin.Password = encriptionMd5;
         db.Admin.InsertOnSubmit(admin);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }