public async Task <ActionResult> Login(LoginViewModel model) { if (ModelState.IsValid) { var result = await bookstoreService.GetToken(model.Email, model.Password); if (result.StartsWith("ERROR")) { ModelState.AddModelError("", "Wrong username or password!"); return(View(model)); } AccessToken.Set(result); return(RedirectToAction("Index", "Book")); } return(View(model)); }
public async Task <string> Login(string email, string password) { return(await bookstoreService.GetToken(email, password)); }