Exemplo n.º 1
0
        public IActionResult Find(TKey id)
        {
            var entity = _service.Find <TEntity, TKey>(id);

            if (entity == null)
            {
                return(BadRequest(new Error()
                {
                    Message = "Invalid Id ..."
                }));
            }
            return(_GetEntityResult(entity));
        }
 public IActionResult ForgetPassword(ForgottenPassword forgottenPassword)
 {
     // if the code doesn't match the Master Code return Exception [BadRequest]
     if (forgottenPassword.VerificationCode != _config.GetValue <string>("MasterVerificationCode"))
     {
         throw new Exception("Invalid Verification Code!!!");
     }
     // get the user by Email
     user = _service.Find <User, string>(forgottenPassword.Email);
     // (_) If user not found then return Exception [BadRequest]
     if (user == null)
     {
         throw new Exception("Invalid User !!!");
     }
     // (_) if user and code ok then Change Password with the new one
     return(_DoChangePassword(user, forgottenPassword.NewPassword));
 }