Beispiel #1
0
 public ActionResult Index(int? Page, bool? Desc, string type, string q)
 {
     int page = 0;
     long numResults;
     if (Page.HasValue && Page.Value>=0)
     {
         page = Page.Value;
     }
     IList<Soul> Souls = null;
     if (q != null)
     {
         var eb = SoulRepository.CreateExpressionBuilder();
         IExpression exp = eb.Like("name", "%" + q + "%", true);
         // Searching doesn't work with pagination. why?
         Souls = SoulRepository.FindByExpression(exp, 40, page, SoulRepository.CreateOrder("name", Desc == true));
         numResults = 40;
     }
     else
     {
         Souls = SoulRepository.GetAll(40, page, out numResults, SoulRepository.CreateOrder("name", Desc == true));
      }
     PaginationData pd = new ThreeWayPaginationData(page, 40, numResults);
     ViewData["Pagination"] = pd;
     if (type == "json")
     {
         return new JsonNetResult(Souls);
     }
     else
     {
         return View(Souls);
     }
 }
Beispiel #2
0
 public ActionResult Index(int? Page, bool? Desc, string type, string q)
 {
     int page = 0;
     long numResults;
     if (Page.HasValue && Page.Value >= 0)
     {
         page = Page.Value;
     }
     IList<Tag> Tags = null;
     if (q != null)
     {
         var eb = TagRepository.CreateExpressionBuilder();
         IExpression exp = eb.Like("name", "%" + q + "%", true);
         Tags = TagRepository.FindByExpression(exp, 40, page, out numResults, TagRepository.CreateOrder("name", Desc == true));
     }
     else
     {
         Tags = TagRepository.GetAll(40, page, out numResults, TagRepository.CreateOrder("name", Desc == true));
     }
     PaginationData pd = new ThreeWayPaginationData(page, 40, numResults);
     ViewData["Pagination"] = pd;
     if (type == "json")
     {
         return new JsonNetResult(Tags);
     }
     else
     {
         return View(Tags);
     }
 }
Beispiel #3
0
 public ActionResult Index(int? Page, string OrderBy, bool? Desc)
 {
     long numResults;
     int page = 0;
     if (Page != null)
     {
         page = (int)Page;
     }
     IList<WebSample> WebSamples = null;
     WebSamples = WebSampleRepository.GetAll(20, page, out numResults, WebSampleRepository.CreateOrder(OrderBy,Desc==true));
     PaginationData pd = new ThreeWayPaginationData(page, 20, numResults);
     ViewData["Pagination"] = pd;
     return View(WebSamples);
 }