public ActionResult GetSortedDocumentsByFilter(FilterModel filter, SortModel sortInfo)
 {
     var documentModels = new DocumentMainViewModel();
     if (sortInfo.IsSet())
     {
         if (sortInfo.PreviousTarget == null || sortInfo.TargetIsChange())
         {
             sortInfo.Ascending = true;
         }
         else
         {
             sortInfo.Ascending = !sortInfo.Ascending;
         }
     }
     var filterInfo = mapper.GetFilterInfo(filter, sortInfo);
     var filteredDocuments = docService.GetSortedDocumentsByFilter(filterInfo);
     filteredDocuments.ForEach(doc => documentModels.Documents.Add(mapper.GetDocumentViewModel(doc)));
     documentModels.Filter = mapper.GetFilterModel(filterInfo);
     documentModels.SortParam = mapper.GetSortModel(filterInfo);
     return View("Index", documentModels);
 }
 public ActionResult Index()
 {
     var allDocsViewModel = new DocumentMainViewModel();
     List<Document> allDocsDomain = docService.GetAllDocuments();
     allDocsDomain.ForEach(doc => allDocsViewModel.Documents.Add(mapper.GetDocumentViewModel(doc)));
     return View(allDocsViewModel);
 }