public ActionResult Index(EventsPagingFilteringModel command) { if (command.PageNumber <= 0) command.PageNumber = 1; var model = new EventIndexModel(); var events = _eventService.GetAllEvents(pageIndex: command.PageNumber - 1, pageSize: 10); model.Events = events.Select(q => { var project = q.ToModel(); project.PictureModel = new PictureModel { ImageUrl = _pictureService.GetPictureUrl(q.PictureId, 290), FullSizeImageUrl = _pictureService.GetPictureUrl(q.PictureId) }; return project; }).ToList(); model.PagingFilteringContext.LoadPagedList(events); return View(model); }
public EventIndexModel() { PagingFilteringContext = new EventsPagingFilteringModel(); }