public ActionResult Uploaded(int id = 1)
        {
            int    page       = id;
            string devName    = this.User.Identity.Name;
            int    allApps    = this.applications.GetByCreator(devName).Count();
            var    totalPages = (int)Math.Ceiling(allApps / (decimal)WebConstants.AppsPerPage);

            var cat = this.categories.GetAll().To <CategoryViewModel>().ToList();

            var apps = this.applications.GetAll()
                       .Where(x => x.Creator.UserName == devName)
                       .OrderBy(x => x.Id)
                       .Skip((page - 1) * WebConstants.AppsPerPage)
                       .Take(WebConstants.AppsPerPage)
                       .To <ApplicationViewModel>()
                       .ToList();

            // TODO: check this.Cache service work

            //var categories =
            //    this.Cache.Get(
            //        "categories",
            //        () => this.categories.GetAll(),
            //        5 * 60);

            var devAppsModel = new DeveloperApplicationsViewModel
            {
                Applications = apps,
                CurrentPage  = page,
                TotalPages   = totalPages
            };

            return(View(devAppsModel));
        }
Пример #2
0
        public ActionResult Index(int id = 1)
        {
            int page = id;

            var apps = this.applications.GetAll()
                .OrderBy(x => x.Id)
                .To<ApplicationViewModel>()
                .ToList();

            var totalPages = (int)Math.Ceiling(apps.Count / (decimal)WebConstants.AppsPerPage);

            var devAppsModel = new DeveloperApplicationsViewModel
            {
                Applications = apps,
                CurrentPage = page,
                TotalPages = totalPages
            };
            return View(devAppsModel);
        }
Пример #3
0
        public ActionResult Index(int id = 1)
        {
            int page = id;

            var apps = this.applications.GetAll()
                       .OrderBy(x => x.Id)
                       .To <ApplicationViewModel>()
                       .ToList();

            var totalPages = (int)Math.Ceiling(apps.Count / (decimal)WebConstants.AppsPerPage);

            var devAppsModel = new DeveloperApplicationsViewModel
            {
                Applications = apps,
                CurrentPage  = page,
                TotalPages   = totalPages
            };

            return(View(devAppsModel));
        }