Example #1
0
        public ActionResult ViewSection(int sectionId)
        {
            var section = _faqService.GetFaqSectionById(sectionId);
            var entries = _faqService.GetFaqEntries(culture, sectionId).Join <BodyPartRecord>().List();

            return(View(new ViewSectionViewModel {
                Section = section, Topics = entries.ToArray()
            }));
        }
Example #2
0
        public ActionResult EditFaqEntryPOST(int id, FormCollection input, string returnUrl)
        {
            var faqEntryPart = _faqService.GetFaqEntry(id);

            faqEntryPart.Section = _faqService.GetFaqSectionById(int.Parse(input["FaqEntryPart.SectionId"]));

            var model = Services.ContentManager.UpdateEditor(faqEntryPart, this);

            if (!ModelState.IsValid)
            {
                foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage))
                {
                    Services.Notifier.Error(T(error));
                }
                return(View(model));
            }

            Services.Notifier.Information(T("The FAQ topic has been updated."));
            return(this.RedirectLocal(returnUrl, () => RedirectToAction("Index")));
        }