Example #1
0
 // Reset Password
 public IHttpActionResult ResetPassword(MemberChangePassword resetpassword)
 {
     try
     {
         var userobj = new UserRepository().ResetPassword(resetpassword);
         if (userobj == true)
         {
             return(Success(Messages.SUCCESS));
         }
         return(Error(Messages.FAIL));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message.ToString()));
     }
 }
 public bool ResetPassword(MemberChangePassword resetpassword)
 {
     try
     {
         var _getpassword = db.userprofiles.Where(x => x.UserId == resetpassword.MemberId).FirstOrDefault();
         if (_getpassword.Password == resetpassword.OldPassword)
         {
             _getpassword.Password = resetpassword.NewPassword;
             db.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
 }