public ActionResult Search(string search, int?chef, int[] meals, int page, int?pivot) { var ps = 7; var list = repo.Where(o => o.Name.Contains(search), WebUtils.IsUserAdmin()); if (chef.HasValue) { list = list.Where(o => o.ChefId == chef.Value); } if (meals != null) { list = list.Where(o => meals.All(m => o.Meals.Select(g => g.Id).Contains(m))); } list = list.OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(ps + 1).ToList(); var isMore = items.Count > ps; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Dinner", items.Take(ps).ToList()), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } return(Json(result)); }
public ActionResult GetDinners(string search, bool isTheadEmpty, int?pageSize, int?pivot) { var ps = pageSize ?? 7; search = (search ?? "").ToLower().Trim(); var list = Db.Dinners.Where(o => o.Name.ToLower().Contains(search)) .OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(ps + 1).ToList(); var isMore = items.Count > ps; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Dinner", items.Take(ps)), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } if (isTheadEmpty) { result.Thead = this.RenderPartialView("ListItems/DinnerThead"); } return(Json(result)); }
//isTheadEmpty is sent only when .TableLayout(true) public ActionResult Search(int[] categories, string name, string orderby, int page, bool isTheadEmpty) { categories = categories ?? new int[] { }; name = (name ?? string.Empty).ToLower().Trim(); const int PageSize = 10; var list = Db.Meals.Where(o => (!categories.Any() || o.Category != null && categories.Contains(o.Category.Id)) && o.Name.ToLower().Contains(name)).OrderByDescending(o => o.Id); if (orderby == "Name") { list = list.OrderBy(o => o.Name); } if (orderby == "Category") { list = list.OrderBy(o => o.Category.Name); } var r = new AjaxListResult { Content = this.RenderView("ListItems/MealCrud", list.Skip((page - 1) * PageSize).Take(PageSize)), More = list.Count() > page * PageSize }; if (isTheadEmpty) { r.Thead = this.RenderView("ListItems/MealCrudThead"); } return(Json(r)); }
//when using TableLayout(true) we will get a isTheadEmpty bool variable //which will tell us whether the table header is empty public ActionResult Search(string search, int page, bool isTheadEmpty) { const int PageSize = 5; search = (search ?? "").ToLower().Trim(); var list = Db.Meals.Where(f => f.Name.ToLower().Contains(search)); //viewdata will be passed to RenderView //in meal.ascx there's a check for ViewData["multilookup"] // if it's not null the move button for the multilookup will be rendered ViewData["multilookup"] = true; var result = new AjaxListResult { Content = this.RenderView("ListItems/Meal", list.Skip((page - 1) * PageSize).Take(PageSize)), More = list.Count() > page * PageSize }; //setting the table header with rendered html if (isTheadEmpty) { result.Thead = this.RenderView("ListItems/MealThead"); } return(Json(result)); }
public ActionResult Search(string search, int[] selected, int?pageSize, int?pivot, int page = 1) { var ps = pageSize ?? 10; var list = repo.GetAll().Where(o => o.Name.Contains(search)); if (selected != null) { list = list.Where(o => !selected.Contains(o.Id)).AsQueryable(); } list = list.OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(ps + 1).ToList(); var isMore = items.Count > ps; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/MealLookupItem", items.Take(ps).ToList()), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } return(Json(result)); }
public ActionResult Search(string search, int page) { var list = repo.GetAll().OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/Feedback", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; return Json(result); }
public ActionResult Search(string search, int page) { var list = repo.GetAll().OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/Feedback", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; return(Json(result)); }
public ActionResult Search(int page, bool isTheadEmpty) { const int PageSize = 5; var result = new AjaxListResult { Content = this.RenderView("CustomItems", Db.Meals.Skip((page - 1) * PageSize).Take(PageSize)), More = Db.Meals.Count > page*PageSize }; if (isTheadEmpty) result.Thead = this.RenderView("TableHeader"); return Json(result); }
public ActionResult Search(string search, int page) { var list = repo.Where(o => o.Name.StartsWith(search), User.IsInRole("admin")) .OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/Country", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; return Json(result); }
public ActionResult Search(string search, int page) { var list = repo.Where(o => o.Name.StartsWith(search), User.IsInRole("admin")) .OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/Country", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; return(Json(result)); }
public ActionResult Selected(int[] selected, bool isTheadEmpty) { ViewData["multilookup"] = true; var result = new AjaxListResult { Content = this.RenderView("ListItems/Meal", Db.Meals.Where(o => selected != null && selected.Contains(o.Id))) }; if (isTheadEmpty) { result.Thead = this.RenderView("ListItems/MealThead"); } return(Json(result)); }
public ActionResult Search(string search, int page, bool isTheadEmpty) { var list = repo.Where(o => (o.FirstName + " " + o.LastName).Contains(search), User.IsInRole("admin")) .OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/Chef", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; if (isTheadEmpty) result.Thead = this.RenderView("ListItems/ChefThead"); return Json(result); }
public ActionResult Search(string search, int page, bool isTheadEmpty, int? pageSize) { pageSize = pageSize ?? 10; search = (search ?? "").ToLower().Trim(); var list = Db.Dinners.Where(o => o.Name.ToLower().Contains(search)) .OrderByDescending(o => o.Id); var r = new AjaxListResult { Content = this.RenderView("ListItems/Dinner", list.Skip((page - 1) * pageSize.Value).Take(pageSize.Value)), More = list.Count() > page * pageSize }; if (isTheadEmpty) r.Thead = this.RenderView("ListItems/DinnerThead"); return Json(r); }
public ActionResult Search(string search, int page, bool isTheadEmpty, int userTypeId) { var list = repo.Where(o => o.Login.StartsWith(search) && o.UserTypeId == userTypeId, User.IsInRole("admin")).OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/Retailer", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; if (isTheadEmpty) { result.Thead = this.RenderView("ListItems/RetailerThead"); } return(Json(result)); }
public ActionResult Search(int page, bool isTheadEmpty) { const int PageSize = 5; var result = new AjaxListResult { Content = this.RenderView("CustomItems", Db.Meals.Skip((page - 1) * PageSize).Take(PageSize)), More = Db.Meals.Count > page * PageSize }; if (isTheadEmpty) { result.Thead = this.RenderView("TableHeader"); } return(Json(result)); }
public ActionResult Search(string search, int?chef, int[] meals, int?pivot) { AjaxListResult res; Func <AjaxListResult> getData = () => { var pageSize = 7; var list = repo.GetAll(WebUtils.IsUserAdmin()).Where(o => o.Name.Contains(search)); if (chef.HasValue) { list = list.Where(o => o.ChefId == chef.Value); } if (meals != null) { list = list.Where(o => meals.All(m => o.Meals.Select(g => g.Id).Contains(m))); } list = list.OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(pageSize + 1).ToList(); var isMore = items.Count > pageSize; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Dinner", items.Take(pageSize).ToList()), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } return(result); }; if (!WebUtils.IsUserAdmin() && search == "" && chef == null && meals == null && pivot == null) { res = cache.Get("dinnersList", () => getData(), nameof(Dinner)); } else { res = getData(); } return(Json(res)); }
public ActionResult Selected(int[] selected, bool isTheadEmpty) { selected = selected ?? new int[] { }; ViewData["multilookup"] = true; // used in ListItems/Meal.cshtml var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Meal", Db.Meals.Where(o => selected.Contains(o.Id))) }; if (isTheadEmpty) { result.Thead = this.RenderPartialView("ListItems/MealThead"); } return(Json(result)); }
public ActionResult Search(string search, int page, bool isTheadEmpty) { var list = repo.Where(o => (o.BranchName + " " + o.Address).Contains(search), User.IsInRole("admin")) .OrderBy(o => o.BranchName); var result = new AjaxListResult { Content = this.RenderView("ListItems/Branch", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; if (isTheadEmpty) { result.Thead = this.RenderView("ListItems/BranchThead"); } return(Json(result)); }
public ActionResult Search(string search, int page, bool isTheadEmpty) { var list = repo.Where(o => (o.Description).Contains(search), User.IsInRole("admin")) .OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/ProductCategory", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; if (isTheadEmpty) { result.Thead = this.RenderView("ListItems/ProductCategoryThead"); } return(Json(result)); }
public ActionResult Search(string search, int page, bool isTheadEmpty, int?pageSize) { pageSize = pageSize ?? 10; search = (search ?? "").ToLower().Trim(); var list = Db.Dinners.Where(o => o.Name.ToLower().Contains(search)) .OrderByDescending(o => o.Id); var r = new AjaxListResult { Content = this.RenderView("ListItems/Dinner", list.Skip((page - 1) * pageSize.Value).Take(pageSize.Value)), More = list.Count() > page * pageSize }; if (isTheadEmpty) { r.Thead = this.RenderView("ListItems/DinnerThead"); } return(Json(r)); }
public ActionResult Search(DateTime?date, int page) { const int PageSize = 5; if (!date.HasValue) { date = DateTime.Now; } var list = Db.Dinners.Where(o => o.Date <= date) .OrderByDescending(o => o.Id); var r = new AjaxListResult { Items = list.Skip((page - 1) * PageSize).Take(PageSize).Select(o => new KeyContent(o.Id, string.Format("{0} {1}", o.Name, o.Date.ToShortDateString()))), More = list.Count() > page * PageSize }; return(Json(r)); }
//when using TableLayout(true) we will get a isTheadEmpty bool variable //which will tell us wheter the table header is empty public ActionResult Search(string search, int page, bool isTheadEmpty) { const int PageSize = 5; search = (search ?? "").ToLower().Trim(); var list = Db.Meals.Where(f => f.Name.ToLower().Contains(search)); var result = new AjaxListResult { Content = this.RenderView("ListItems/Meal", list.Skip((page - 1) * PageSize).Take(PageSize)), More = list.Count() > page * PageSize }; //setting the table header with rendered html if (isTheadEmpty) { result.Thead = this.RenderView("ListItems/MealThead"); } return(Json(result)); }
//isTheadEmpty is sent only when .TableLayout(true) public ActionResult Search(int[] categories, string name, string orderby, int page, bool isTheadEmpty) { categories = categories ?? new int[] { }; name = (name ?? string.Empty).ToLower().Trim(); const int PageSize = 10; var list = Db.Meals.Where(o => (!categories.Any() || o.Category != null && categories.Contains(o.Category.Id)) && o.Name.ToLower().Contains(name)).OrderByDescending(o => o.Id); if (orderby == "Name") list = list.OrderBy(o => o.Name); if (orderby == "Category") list = list.OrderBy(o => o.Category.Name); var r = new AjaxListResult { Content = this.RenderView("ListItems/MealCrud", list.Skip((page - 1) * PageSize).Take(PageSize)), More = list.Count() > page * PageSize }; if (isTheadEmpty) r.Thead = this.RenderView("ListItems/MealCrudThead"); return Json(r); }
public ActionResult Search(string search, int page, bool isTheadEmpty, int? pageSize) { pageSize = pageSize ?? 10; search = (search ?? "").ToLower(); var items = UnitOfWork.AlojamientoRepository.Get(); if (!string.IsNullOrWhiteSpace(search)) { items = items.Where(o => o.caracteristicas.ToLower().Contains(search)); } items = items.OrderByDescending(x => x.Id); var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Index", items.Skip((page - 1) * pageSize.Value).Take(pageSize.Value)), More = items.Count() > page * pageSize }; if (isTheadEmpty) result.Thead = this.RenderPartialView("ListItems/Thead"); return Json(result); }
public ActionResult Search(string search, int?pivot) { var pageSize = 7; var list = repo.GetAll <Feedback>().OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(pageSize + 1).ToList(); var isMore = items.Count > pageSize; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Feedback", items.Take(pageSize).ToList()), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } return(Json(result)); }
public ActionResult Search(string search, int page, int?pageSize, int?pivot) { var ps = pageSize ?? 10; var list = repo.Where(o => o.Name.Contains(search), WebUtils.IsUserAdmin()) .OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(ps + 1).ToList(); var isMore = items.Count > ps; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Meal", items.Take(ps).ToList()), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } return(Json(result)); }
public ActionResult Search(string search, int?pivot, int pageSize = 10) { AjaxListResult res; Func <AjaxListResult> getData = () => { var list = repo.GetAll(WebUtils.IsUserAdmin()).Where(o => o.Name.Contains(search)) .OrderByDescending(o => o.Id); var items = (pivot.HasValue ? list.Where(o => o.Id <= pivot.Value) : list).Take(pageSize + 1).ToList(); var isMore = items.Count > pageSize; var result = new AjaxListResult { Content = this.RenderPartialView("ListItems/Meal", items.Take(pageSize).ToList()), More = isMore }; if (isMore) { result.Pivot = items.Last().Id; } return(result); }; if (!WebUtils.IsUserAdmin() && search == "" && pivot == null) { res = cache.Get("mealsList&ps=" + pageSize, () => getData(), typeof(Meal)); } else { res = getData(); } return(Json(res)); }
public ActionResult Selected(int[] selected, bool isTheadEmpty) { ViewData["multilookup"] = true; var result = new AjaxListResult { Content = this.RenderView("ListItems/Meal",Db.Meals.Where(o => selected != null && selected.Contains(o.Id))) }; if (isTheadEmpty) result.Thead = this.RenderView("ListItems/MealThead"); return Json(result); }
//when using TableLayout(true) we will get a isTheadEmpty bool variable //which will tell us whether the table header is empty public ActionResult Search(string search, int page, bool isTheadEmpty) { const int PageSize = 5; search = (search ?? "").ToLower().Trim(); var list = Db.Meals.Where(f => f.Name.ToLower().Contains(search)); //viewdata will be passed to RenderView //in meal.ascx there's a check for ViewData["multilookup"] // if it's not null the move button for the multilookup will be rendered ViewData["multilookup"] = true; var result = new AjaxListResult { Content = this.RenderView("ListItems/Meal", list.Skip((page - 1) * PageSize).Take(PageSize)), More = list.Count() > page * PageSize }; //setting the table header with rendered html if (isTheadEmpty) result.Thead = this.RenderView("ListItems/MealThead"); return Json(result); }
//when using TableLayout(true) we will get a isTheadEmpty bool variable //which will tell us wheter the table header is empty public ActionResult Search(string search, int page, bool isTheadEmpty) { const int PageSize = 5; search = (search ?? "").ToLower().Trim(); var list = Db.Meals.Where(f => f.Name.ToLower().Contains(search)); var result = new AjaxListResult { Content = this.RenderView("ListItems/Meal", list.Skip((page - 1) * PageSize).Take(PageSize)), More = list.Count() > page * PageSize }; //setting the table header with rendered html if (isTheadEmpty) result.Thead = this.RenderView("ListItems/MealThead"); return Json(result); }
public ActionResult Search(string search, int page, bool isTheadEmpty, int userTypeId) { var list = repo.Where(o => o.Login.StartsWith(search) && o.UserTypeId==userTypeId, User.IsInRole("admin")).OrderByDescending(o => o.Id); var result = new AjaxListResult { Content = this.RenderView("ListItems/User", list.Page(page, 10).ToList()), More = list.Count() > page * 10 }; if (isTheadEmpty) result.Thead = this.RenderView("ListItems/UserThead"); return Json(result); }