Exemplo n.º 1
0
        public ActionResult Faq(Guid categoryId)
        {
            FaqCategory          category;
            List <FaqTableModel> faq = null;

            using (ContextManager.NewConnection())
            {
                category = faqService.GetFaqCategory(categoryId, false);
                if (category != null)
                {
                    faq = faqService.Search(new FaqQueryModel {
                        Category = new Nomenclature {
                            Id = categoryId
                        }, Status = EnumHelper.GetFaqStatus(FaqStatus.Public).Value
                    });
                }
            }

            if (category == null)
            {
                throw new UserException(Resource.NoDataFound);
            }

            ViewBag.CategoryId = categoryId;

            this.InitViewTitleAndBreadcrumbs(category.Names.GetValueForCurrentCulture(), new[] { new Breadcrumb {
                                                                                                     Title = Resource.FAQ
                                                                                                 } });
            return(View("Faq", faq));
        }
Exemplo n.º 2
0
        public ActionResult Rearrange(int oldIndex, int newIndex)
        {
            using (var transaction = ContextManager.NewTransaction())
            {
                var faqs = new ObservableCollection <FaqTableModel>(faqService.Search(new FaqQueryModel()));
                faqs.Move(oldIndex, newIndex);
                faqService.Rearrange(faqs.Select(x => x.Id.Value).ToArray());
                transaction.Commit();
            }

            return(Json(new { success = true }));
        }