public ActionResult Index(ServicesPagingFilteringModel command) { if (command.PageNumber <= 0) command.PageNumber = 1; var model = new ServiceIndexModel(); var services = _serviceService.GetAllServices(pageIndex: command.PageNumber - 1, pageSize: 5); model.Services = services.Select(q => { var service = q.ToModel(); service.PictureModel = new PictureModel { ImageUrl = _pictureService.GetPictureUrl(q.PictureId, 300), FullSizeImageUrl = _pictureService.GetPictureUrl(q.PictureId) }; return service; }).ToList(); model.PagingFilteringContext.LoadPagedList(services); return View(model); }
public ServiceIndexModel() { PagingFilteringContext = new ServicesPagingFilteringModel(); }