コード例 #1
0
ファイル: Mapper.cs プロジェクト: Shinyshade/DocumentStorage
 public FilterModel GetFilterModel(FilterInfo info)
 {
     var filter = new FilterModel();
     filter.NameKeyWord = info.NameKeyWord;
     filter.DateKeyWord = info.DateKeyWord;
     filter.AuthorKeyword = info.AuthorKeyword;
     return filter;
 }
コード例 #2
0
ファイル: Mapper.cs プロジェクト: Shinyshade/DocumentStorage
 public FilterInfo GetFilterInfo(FilterModel filter, SortModel sortInfo)
 {
     var info = new FilterInfo();
     info.NameKeyWord = filter.NameKeyWord;
     info.DateKeyWord = filter.DateKeyWord;
     info.AuthorKeyword = filter.AuthorKeyword;
     info.Ascending = sortInfo.Ascending;
     info.Target = sortInfo.CurrentTarget;
     return info;
 }
コード例 #3
0
 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);
 }