Beispiel #1
0
        public ActionResult Create()
        {
            //Model used to combine a faq object and departments list for dropdown
            EditFaq modelView = new EditFaq();

            // FAQ is empty for before creating new FAQ
            modelView.Faq = new FaqDto();

            //The view needs to be sent a list of all the Departments so the client can select a Department for FAQ in the view
            modelView.DepartmentsSelectList = GetDepartmentSelectList();

            return(View(modelView));
        }
Beispiel #2
0
        public ActionResult Edit(int id, EditFaq faqInfo)
        {
            string url = "faqdata/updatefaq/" + id;

            HttpContent content = new StringContent(jss.Serialize(faqInfo.Faq));

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage response = client.PostAsync(url, content).Result;

            if (response.IsSuccessStatusCode)
            {
                return(RedirectToAction("AdminList"));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Beispiel #3
0
        public ActionResult Edit(int id)
        {
            //Model used to combine a faq object and departments list for dropdown
            EditFaq modelView = new EditFaq();

            //Get the current ParkingSpot object
            string url = "FaqData/FindFaq/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            if (response.IsSuccessStatusCode)
            {
                FaqDto SelectedFaq = response.Content.ReadAsAsync <FaqDto>().Result;
                modelView.Faq = SelectedFaq;
            }
            else
            {
                return(RedirectToAction("Error"));
            }

            //The view needs to be sent a list of all the Departments so the client can select a Department for FAQ in the view
            modelView.DepartmentsSelectList = GetDepartmentSelectList();

            return(View(modelView));
        }