public async Task <User> ExecuteAsync(AuthorizationViewModel request) { var user = await this.dataContext.Users.FirstOrDefaultAsync(x => x.Email == request.Login); if (user == null) { throw new CoreException(ResultCode.UserAlreadyExist); } if (user.Password != SecurityFactory.HashPassword(request.Password, user.Salt)) { throw new CoreException(ResultCode.UserIncorrectPassword); } return(user); }