Esempio n. 1
0
        public ActionResult List(ShortUrlListCommand command)
        {
            int urlPerPage            = settings.UrlPerPage;
            ShortUrlListResult result = shortUrlService.FindByUser(command.UserName, PageCalculator.StartIndex(command.Page, urlPerPage), urlPerPage);

            object model = new PagedListViewModel <ShortUrlDTO>(result.ShortUrls, command.Page ?? 1, urlPerPage, result.Total);

            return(this.AdaptiveView(result.RuleViolations, model));
        }
Esempio n. 2
0
        private ActionResult PrepareListActionResult <TItem>(int?page, Func <IEnumerable <TItem> > getItems) where TItem : class
        {
            IEnumerable <TItem> items = getItems().Skip(PageCalculator.StartIndex(page, ItemPerPage))
                                        .Take(ItemPerPage);

            int count = getItems().Count();

            ViewData.Model = new PagedListViewModel <TItem>(items, page ?? 1, ItemPerPage, count);

            return(this.AdaptiveView());
        }