public User GetUserByLogon(LogonModel model) { using (var db = new Db()) { return db.Users.FirstOrDefault(u => u.UserName == model.UserName && u.Password == model.UserPass); } return null; }
public string GetAuthToken(LogonModel model) { if (ModelState.IsValid) { var registerUserId = GetUserByLogon(model).Id; var token = TokenService.CreateToken(registerUserId); return token; } return null; }