Beispiel #1
0
        public ActionResult FilterSnippets(FilterSnippetsInput filterData, string view)
        {
            var snippets = _snippetService.FilterSnippets(filterData);
            ListSnippetsPartialViewModel vm = new ListSnippetsPartialViewModel
            {
                Snippets = snippets
            };

            if (!string.IsNullOrEmpty(filterData.selectedSnippets))
            {
                List <int> selectedSnippets = filterData.selectedSnippets.Split(',').Select(Int32.Parse).ToList();
                vm.Snippets = vm.Snippets.Where(x => !selectedSnippets.Contains(x.ID)).ToList();
            }

            if (view == "snippets")
            {
                vm.SnippetsButtons  = true;
                vm.SpanSizeSnippets = "span9";
                vm.SpanSizeArea     = "span12";
            }
            else if (view == "CreateEvent")
            {
                vm.SnippetsButtons  = false;
                vm.SpanSizeSnippets = "span6";
                vm.SpanSizeArea     = "span6";
                vm.DivName          = "snippets";
            }
            return(PartialView("_ListSnippets", vm));
        }