コード例 #1
0
 public ActionResult Index(SourceSearch search)
 {
     //真实数据MediaGroupId为空,通过底层Whereif方法进行过滤
     if (search.MediaType == null)
     {
         search.MediaType = 1;
     }
     SourceViewModel vmodel = new SourceViewModel();
     if (search.MediaType == 1)
     {
         var slist = ObjectMapper.Map<List<Source>>(plist.Where(q=>q.MediaGroupId==search.MediaGroupId));
         PagedList<Source> model = slist.OrderBy(q => q.Id).ToPagedList(search.pageIndex, search.pageSize);
         vmodel.MediaType = (int)search.MediaType;
         vmodel.sourcelist = model;
     }
     else if (search.MediaType == 2)
     {
         var slist = ObjectMapper.Map<List<Source>>(piclist.Where(q => q.MediaGroupId == search.MediaGroupId));
         PagedList<Source> model = slist.OrderBy(q => q.Id).ToPagedList(search.pageIndex, search.pageSize);
         vmodel.MediaType = (int)search.MediaType;
         vmodel.sourcelist = model;
     }
     else if (search.MediaType == 3)
     {
         var slist = ObjectMapper.Map<List<Source>>(alist.Where(q => q.MediaGroupId == search.MediaGroupId));
         PagedList<Source> model = slist.OrderBy(q => q.Id).ToPagedList(search.pageIndex, search.pageSize);
         vmodel.MediaType = (int)search.MediaType;
         vmodel.sourcelist = model;
     }
     else
     {
         var slist = ObjectMapper.Map<List<Source>>(vlist.Where(q => q.MediaGroupId == search.MediaGroupId));
         PagedList<Source> model = slist.OrderBy(q => q.Id).ToPagedList(search.pageIndex, search.pageSize);
         vmodel.MediaType = (int)search.MediaType;
         vmodel.sourcelist = model;
     }
     if (Request.Headers["X-Requested-With"] == "XMLHttpRequest")
     {
         switch (search.MediaType)
         {
             case 1:
                 return PartialView("PanoramList", vmodel.sourcelist);
             case 2:
                 return PartialView("PictureList", vmodel.sourcelist);
             case 3:
                 return PartialView("AudioList", vmodel.sourcelist);
             case 4:
                 return PartialView("VideoList", vmodel.sourcelist);
             default:
                 break;
         }
     }
     return View(vmodel);
 }
コード例 #2
0
ファイル: VarScopeSelect.cs プロジェクト: jwofles/ForkSO
 public VarScopeSelect()
 {
     InitializeComponent();
     SourceSearch.Focus();
 }