public IActionResult Login(UserViewModel user) { if (ModelState.IsValid) { _credentialsRepository.SetUser(user.ConvertTo()); return(RedirectToAction("Index")); } else { ViewBag.Error = "Please input all fields."; } return(View(user)); }