Example #1
0
        public ActionResult Sort(string sortOrder)
        {
            SearchCtx ctx = (SearchCtx)TempData["SearchCtx"];

            if (ctx == null)
            {
                ctx = new SearchCtx();
            }
            ctx.Sort(sortOrder);
            TempData["SearchCtx"] = ctx;
            TempData["vehicles"]  = ctx.Results;
            return(RedirectToAction("Admin", new { page = 1 }));
        }
Example #2
0
        private ActionResult ShowAdmin(SearchCtx ctx, int page = 1)
        {
            if (ctx == null)
            {
                ctx = (SearchCtx)TempData["SearchCtx"];
            }
            if (ctx == null)
            {
                ctx = new SearchCtx();
            }
            ctx.TypesById = garage.TypesById();
            if (ctx.Results.Count == 0)
            {
                ctx.Results = garage.Search(ctx).ToList();
            }
            ctx.PagedResults = ctx.Results.ToPagedList(page, 10);

            TempData["vehicles"]  = ctx.Results;
            TempData["SearchCtx"] = ctx;
            return(View(ctx));
        }
Example #3
0
 public ActionResult Search(SearchCtx ctx)
 {
     TempData["vehicles"] = garage.Search(ctx).ToList <Vehicle>();
     return(List());
 }
Example #4
0
 public ActionResult Admin(SearchCtx ctx, int page = 1)
 {
     return(ShowAdmin(ctx, page));
 }