public virtual ActionResult GetAll([DataSourceRequest]DataSourceRequest request, bool showArchived) { LogI("GetAll"); var filters = new PhotoshootPickListFilterViewModel() { ShowArchived = showArchived }; var items = PhotoshootPickListViewModel.GetAll(Db, filters); var dataSource = items.ToDataSourceResult(request); return new JsonResult { Data = dataSource, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public static IList <PhotoshootPickListViewModel> GetAll(IUnitOfWork db, PhotoshootPickListFilterViewModel filters) { var query = db.PhotoshootPickLists.GetAllAsDto(); if (!filters.ShowArchived) { query = query.Where(f => !f.Archived); } return(query .OrderByDescending(f => f.CreateDate) .ToList() .Select(f => new PhotoshootPickListViewModel(f)) .ToList()); }