public ActionResult Index(PagerParameters pagerParameters, AdminSearchViewModel adminViewModel)
        {
            var categoriesList = _campCategService.GetAllCategories().OrderBy(c => c.Name).ToList();

            if (!string.IsNullOrEmpty(adminViewModel.SearchString))
            {
                categoriesList = categoriesList.Where(c => c.Name.ToLower().Contains(adminViewModel.SearchString)).OrderBy(c => c.Name).ToList();
            }

            var entriesProjection = categoriesList.Select(e =>
            {
                return Shape.FaqEntry(
                    Id: e.Id,
                    Name: e.Name,
                    IsVisible: e.IsVisible
                    );
            });

            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters.Page, pagerParameters.PageSize);
            var entries = entriesProjection.Skip(pager.GetStartIndex()).Take(pager.PageSize);
            var pagerShape = Shape.Pager(pager).TotalItemCount(entriesProjection.Count());

            return View("Index", new AdminSearchViewModel { CampaignCategoriesList = entries.ToArray(), Action = Actions, Pager = pagerShape });
        }
        public ActionResult ChangeNameCategory(AdminSearchViewModel adminViewModel)
        {
            if (!string.IsNullOrEmpty(adminViewModel.NewCategory))
            {
                if (_campCategService.ChnageNameCategory(adminViewModel.CategoryId, adminViewModel.NewCategory))
                {
                    Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Information, T("The name was chenged successfully!"));
                }
                else
                {
                    Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Error, T("Can not change name for category. Try again late!"));
                }
            }
            else
            {
                Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Warning, T("You did not enter a name for the update"));
            }

            return this.RedirectToAction("EditCategory", new { id = adminViewModel.CategoryId });
        }
 public ActionResult SearchCampaignForCategory(PagerParameters pagerParameters, AdminSearchViewModel adminViewModel)
 {
     return this.RedirectToAction("AddCampaignForCategory", new { id = adminViewModel.CategoryId, searchString = adminViewModel.SearchString });
 }
        public ActionResult AddNewCategory(AdminSearchViewModel adminViewModel)
        {
            if (!string.IsNullOrEmpty(adminViewModel.NewCategory))
            {
                if (_campCategService.AddCategory(adminViewModel.NewCategory) > 0)
                {
                    Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Information, T("The New Category has been created."));
                }
                else
                {
                    Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Warning, T("This Category already exists!"));
                }
            }
            else
            {
                Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Error, T("Please, enter name of the Category"));
            }

            //CampaignCategoriesPart campaignCategoryPart = Services.ContentManager.New<CampaignCategoriesPart>("CampaignCategories");
            //var model = Services.ContentManager.BuildEditor(campaignCategoryPart);


            return this.RedirectToAction("Index");
        }