public async Task <User> Login(User model, string password) { var user = await Context .Users.FirstOrDefaultAsync(m => m.Username == model.Username); if (user != null) { if (EncryptionService.CheckPassword(user, password)) { return(user); } } return(null); }