public ActionResult CreateDelegationList() { string token = GetToken(); UserModel um = GetUser(); List <UserModel> newum = new List <UserModel>(); CreateDelegationViewModel viewModel = new CreateDelegationViewModel(); try { newum = APIUser.GetUsersForHOD(um.Deptid, token, out string error); ViewBag.userlist = newum; if (error != "") { return(RedirectToAction("Index", "Error", new { error })); } } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { error = ex.Message })); } return(View(viewModel)); }