public ActionResult EditFaq(carrot_FaqCategory model)
        {
            if (ModelState.IsValid)
            {
                using (FaqHelper fh = new FaqHelper(this.SiteID)) {
                    var fc = fh.CategoryGetByID(model.FaqCategoryID);

                    if (fc == null || model.FaqCategoryID == Guid.Empty)
                    {
                        model.FaqCategoryID = Guid.NewGuid();
                        fc               = new carrot_FaqCategory();
                        fc.SiteID        = this.SiteID;
                        fc.FaqCategoryID = model.FaqCategoryID;
                    }

                    fc.FAQTitle = model.FAQTitle;

                    fh.Save(fc);
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("EditFaq", model));
            }
        }
        public ActionResult ListFaqItems(FaqListing model)
        {
            model.Items.ToggleSort();
            var srt = model.Items.ParseSort();

            List <carrot_FaqItem> lst = null;

            using (FaqHelper fh = new FaqHelper(this.SiteID)) {
                model.Faq = fh.CategoryGetByID(model.Faq.FaqCategoryID);
                lst       = fh.FaqItemListGetByFaqCategoryID(model.Faq.FaqCategoryID);
            }

            IQueryable <carrot_FaqItem> query = lst.AsQueryable();

            query = query.SortByParm <carrot_FaqItem>(srt.SortField, srt.SortDirection);

            model.Items.DataSource = query.Skip(model.Items.PageSize * model.Items.PageNumberZeroIndex).Take(model.Items.PageSize).ToList();

            model.Items.TotalRecords = lst.Count();

            ModelState.Clear();

            return(View(model));
        }
 public ActionResult EditFaq(Guid id)
 {
     using (FaqHelper fh = new FaqHelper(this.SiteID)) {
         return(View("EditFaq", fh.CategoryGetByID(id)));
     }
 }
 public carrot_FaqCategory GetFaq()
 {
     using (FaqHelper fh = new FaqHelper(this.SiteID)) {
         return fh.CategoryGetByID(this.FaqCategoryID);
     }
 }
Beispiel #5
0
 public carrot_FaqCategory GetFaq()
 {
     using (FaqHelper fh = new FaqHelper(this.SiteID)) {
         return(fh.CategoryGetByID(this.FaqCategoryID));
     }
 }