public async Task <IActionResult> Login(UserViewModel model, string answer) { if (!string.IsNullOrWhiteSpace(answer)) { switch (answer) { case "Login": var result = await _requestHandler.ProcessingRequest(model, ActionMethodType.DoLogin); var response = result.Content.ReadAsStringAsync(); var serverResponse = JsonConvert.DeserializeObject <UserViewModel>(response.Result); if (serverResponse.Token != null) { _cache.Set("Token-" + serverResponse.UserId, serverResponse.Token); _memoryCache.Set <string>("UserId", serverResponse.UserId.ToString()); _memoryCache.Set <string>("UserTypeId", serverResponse.UserTypeId.ToString()); return(RedirectToAction("AddVehicle", "Vehicle")); } ViewBag.Status = serverResponse.RespDesc; break; case "Reset": return(RedirectToAction("Login")); } } return(View(model)); }