public async Task <IActionResult> AssignTest(Assignedtest assignedtest) { try { assignedtest.Id = 0; var response = _apiHandler.AssignTest(assignedtest); Session.Message = new Message() { CssClassName = "alert-sucess", Title = "Success!", Messages = "Test Assigned." }; return(RedirectToAction("Index")); } catch { Session.Message = new Message() { CssClassName = "alert-error", Title = "Error!", Messages = "Operation Failed." }; @ViewBag.ListofCustomers = await _apiHandler.GetCustomers(); @ViewBag.ListofSimTest = _apiHandler.GetSimTest(assignedtest.TestId).Result.TestName; return(View(assignedtest)); } }