public static void CreateModel() { ListEmployees.Add(new Employee(@"Горбовский Дмитрий Владимирович", 27, 1)); ListEmployees.Add(new Employee(@"Горбовская Алина Сергеевна", 24, 2)); ListEmployees.Add(new Employee(@"Фамилия Имя Отчество", 0, 0)); ListDepartments.Add(new Department(0, @"Empty")); ListDepartments.Add(new Department(1, @"Yandex")); ListDepartments.Add(new Department(2, @"Google")); }
// GET: Department/List public ActionResult List() { ListDepartments ViewModel = new ListDepartments(); ViewModel.isadmin = User.IsInRole("Admin"); string url = "departmentdata/getdepartments"; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { IEnumerable <DepartmentDto> SelectedDepaprtments = response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result; ViewModel.departments = SelectedDepaprtments; return(View(ViewModel)); } else { return(RedirectToAction("Error")); } }