Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            UpdateJobPosting ViewModel = new UpdateJobPosting();

            string url = "jobpostingdata/findjobposting/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            //Can catch the status code (200 OK, 301 REDIRECT), etc.
            Debug.WriteLine("edit: " + response.StatusCode);
            if (response.IsSuccessStatusCode)
            {
                JobPostingDto SelectedJobPosting = response.Content.ReadAsAsync <JobPostingDto>().Result;
                ViewModel.jobposting = SelectedJobPosting;


                url      = "departmentdata/getdepartments";
                response = client.GetAsync(url).Result;
                IEnumerable <DepartmentDto> PotentialDepartments = response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result;
                Debug.WriteLine("Jobposting before getDepartment:");

                ViewModel.alldepartments = PotentialDepartments;

                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            UpdateJobPosting ViewModel = new UpdateJobPosting();

            string url = "jobpostingdata/findpost/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            //Can catch the status code (200 OK, 301 REDIRECT), etc.
            //Debug.WriteLine(response.StatusCode);
            if (response.IsSuccessStatusCode)
            {
                //Put data into jobposting data transfer object

                JobPostingDto SelectedJobPostings = response.Content.ReadAsAsync <JobPostingDto>().Result;
                ViewModel.JobPosting = SelectedJobPostings;
                url      = "DepartmentData/GetDepartments";
                response = client.GetAsync(url).Result;
                IEnumerable <DepartmentDto> departments = response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result;
                ViewModel.AllDepartments = departments;
                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Create()
        {
            UpdateJobPosting            ViewModel   = new UpdateJobPosting();
            string                      url         = "DepartmentData/GetDepartments";
            HttpResponseMessage         response    = client.GetAsync(url).Result;
            IEnumerable <DepartmentDto> departments = response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result;

            ViewModel.AllDepartments = departments;
            return(View(ViewModel));
        }
Ejemplo n.º 4
0
        public ActionResult Create()
        {
            UpdateJobPosting ViewModel = new UpdateJobPosting();
            //get information about Department
            string url = "departmentdata/getdepartments";
            HttpResponseMessage         response             = client.GetAsync(url).Result;
            IEnumerable <DepartmentDto> PotentialDepartments = response.Content.ReadAsAsync <IEnumerable <DepartmentDto> >().Result;

            ViewModel.alldepartments = PotentialDepartments;

            return(View(ViewModel));
        }