예제 #1
0
 public int LoginUser(CoreUserLoginModel model)
 {
     try
     {
         var user = db.Users.Where(p => p.Email == model.Email && p.Password == model.Password).FirstOrDefault();
         if (user != null)
         {
             var isactive = user.IsActive;
             if (isactive)
             {
                 if (user.RoleId == model.RoleId)
                 {
                     HttpContext.Current.Session["UserEmailId"] = user.Email;
                     return(user.Id);
                 }
                 else
                 {
                     return(0);
                 }
             }
             else
             {
                 return(-1);
             }
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #2
0
        public bool ForgotPassword(CoreUserLoginModel email)
        {
            User userExist = db.Users.Where(p => p.Email == email.Email).FirstOrDefault();

            if (userExist != null)
            {
                SendNotification notify = new SendNotification();
                notify.SendMailForgotPassword(userExist.Email, userExist.Name, userExist.Password, "Forgot Password");
                return(true);
            }
            else
            {
                return(false);
            }
        }