Ejemplo n.º 1
0
        public ActionResult Create()
        {
            CreatePractice ViewModel = new CreatePractice();

            string URL = "DepartmentData/ListDepartments";
            HttpResponseMessage         Response          = Client.GetAsync(URL).Result;
            IEnumerable <DepartmentDto> ListOfDepartments = Response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result;

            ViewModel.AllDepartments = ListOfDepartments;

            return(View(ViewModel));
        }
Ejemplo n.º 2
0
        public ActionResult Update(int id)
        {
            CreatePractice ViewModel = new CreatePractice();

            string URL = "PracticeData/FindPractice/" + id;

            HttpResponseMessage Response = Client.GetAsync(URL).Result;

            if (Response.IsSuccessStatusCode)
            {
                Practice SelectedPractice = Response.Content.ReadAsAsync <Practice>().Result;
                ViewModel.Practice = SelectedPractice;
                URL      = "DepartmentData/ListDepartments";
                Response = Client.GetAsync(URL).Result;
                IEnumerable <DepartmentDto> NewDepartment = Response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result;
                ViewModel.AllDepartments = NewDepartment;
                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }