public ActionResult Index(int?page)
        {
            // Gets username of logged in user.
            string username = User.Identity.Name;

            IEnumerable <Request> requests = (from item in db.GetAllRequests()
                                              orderby item.DateCreated descending
                                              select item);

            // By default we start at page one
            if (!page.HasValue)
            {
                page = 1;
            }

            int pageSize   = 15;
            int pageNumber = (page ?? 1);

            if (username.Length != 0)
            {
                foreach (Request req in requests)
                {
                    // If you have upvoted this request it will return true, false otherwise.
                    req.UpvotedByUser = db.GetReqUpBool(req.ID, db.GetUserByName(username).ID);
                }
            }

            // Gets language dropdown
            ViewBag.Languages = db.GetLanguageListItems();
            return(View(requests.ToPagedList(pageNumber, pageSize)));
        }
        public ActionResult Index(int?page)
        {
            var subs = (from item in db.GetAllSubtitles()
                        orderby item.DateCreated descending
                        select item);

            if (!page.HasValue)
            {
                page = 1;
            }

            int pageSize   = 15;
            int pageNumber = (page ?? 1);

            ViewBag.Languages = db.GetLanguageListItems();
            return(View(subs.ToPagedList(pageNumber, pageSize)));
        }
Exemple #3
0
 public ActionResult Upload()
 {
     // Gets language dropdown
     ViewBag.Languages = db.GetLanguageListItems();
     return(View(new Subtitle()));
 }