public ActionResult FaqDatabase() { List <string> lst = new List <string>(); DatabaseUpdate du = new DatabaseUpdate(); DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse(); string sqlUpdate = ""; string sqlTest = ""; try { sqlUpdate = FaqHelper.ReadEmbededScript("CarrotCake.CMS.Plugins.FAQ2.carrot_FaqItem.sql"); sqlTest = "select * from [INFORMATION_SCHEMA].[COLUMNS] where table_name in('carrot_FaqCategory')"; dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false); if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) { lst.Add(dbRes.LastException.Message); } else { lst.Add(dbRes.Response); } } catch (Exception ex) { lst.Add(ex.ToString()); } return(View(lst)); }
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 EditFaqItem(carrot_FaqItem model) { if (ModelState.IsValid) { using (FaqHelper fh = new FaqHelper(this.SiteID)) { var fc = fh.FaqItemGetByID(model.FaqItemID); if (fc == null || model.FaqCategoryID == Guid.Empty) { model.FaqItemID = Guid.NewGuid(); fc = new carrot_FaqItem(); fc.FaqCategoryID = model.FaqCategoryID; fc.FaqItemID = model.FaqItemID; } fc.Caption = model.Caption; fc.Question = model.Question; fc.Answer = model.Answer; fc.ItemOrder = model.ItemOrder; fc.IsActive = model.IsActive; fh.Save(fc); } return(RedirectToAction("ListFaqItems", new { @id = model.FaqCategoryID })); } else { return(View("EditFaqItem", model)); } }
public ActionResult DeleteFaqItem(carrot_FaqItem model) { using (FaqHelper fh = new FaqHelper(this.SiteID)) { fh.DeleteItem(model.FaqItemID); } return(RedirectToAction("ListFaqItems", new { @id = model.FaqCategoryID })); }
public ActionResult Index(PagedData <carrot_FaqCategory> model) { model.ToggleSort(); var srt = model.ParseSort(); List <carrot_FaqCategory> lst = null; using (FaqHelper fh = new FaqHelper(this.SiteID)) { lst = fh.CategoryListGetBySiteID(); } IQueryable <carrot_FaqCategory> query = lst.AsQueryable(); query = query.SortByParm <carrot_FaqCategory>(srt.SortField, srt.SortDirection); model.DataSource = query.Skip(model.PageSize * model.PageNumberZeroIndex).Take(model.PageSize).ToList(); model.TotalRecords = lst.Count(); ModelState.Clear(); return(View(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 ActionResult EditFaqItem(Guid id) { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return(View("EditFaqItem", fh.FaqItemGetByID(id))); } }
public List<carrot_FaqItem> GetListTop(int takeTop) { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return fh.FaqItemListPublicTopGetByFaqCategoryID(this.FaqCategoryID, this.SiteID, takeTop); } }
public carrot_FaqItem GetRandomItem() { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return fh.FaqItemListPublicRandGetByFaqCategoryID(this.FaqCategoryID, this.SiteID); } }
public List<carrot_FaqItem> GetList() { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return fh.FaqItemListPublicGetByFaqCategoryID(this.FaqCategoryID, this.SiteID); } }
public carrot_FaqCategory GetFaq() { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return fh.CategoryGetByID(this.FaqCategoryID); } }
public carrot_FaqItem GetRandomItem() { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return(fh.FaqItemListPublicRandGetByFaqCategoryID(this.FaqCategoryID, this.SiteID)); } }
public carrot_FaqCategory GetFaq() { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return(fh.CategoryGetByID(this.FaqCategoryID)); } }
public List <carrot_FaqItem> GetListTop(int takeTop) { using (FaqHelper fh = new FaqHelper(this.SiteID)) { return(fh.FaqItemListPublicTopGetByFaqCategoryID(this.FaqCategoryID, this.SiteID, takeTop)); } }