Beispiel #1
0
        public ActionResult Saved(int?after)
        {
            if (!Request.IsAuthenticated)
            {
                return(View("Error"));
            }

            ViewBag.CurrentPage = "saved";

            // Reset to 0 if negative or null
            int afterSpray = after ?? 0;

            if (afterSpray < 0)
            {
                afterSpray = 0;
            }

            SprayListModel sprays = new SprayListModel();

            sprays.Start = afterSpray;
            sprays.Prev  = afterSpray - SPRAYS_PER_PAGE < 0 ? 0 : afterSpray - SPRAYS_PER_PAGE;

            using (var db = new SprayContext())
            {
                long steamId64 = long.Parse(User.Identity.Name);

                sprays.Sprays = db.Users.Where(u => u.SteamId == steamId64).First().Saved.Where(s => s.Status != Status.DELETED).Where(s => s.Status != Status.ACTIVE).OrderByDescending(s => s.DateAdded).Skip(afterSpray).Take(SPRAYS_PER_PAGE).ToList();
            }

            sprays.Next = sprays.Sprays.Count < SPRAYS_PER_PAGE ? afterSpray : afterSpray + SPRAYS_PER_PAGE;

            return(View(sprays));
        }
Beispiel #2
0
        public ActionResult Manage(int?after)
        {
            /* CHANGEME - This is my Steam ID. If I logged in, I got extra admin options */
            if (!Request.IsAuthenticated || (User.Identity.Name != "76561197999489042"))
            {
                return(View("Error"));
            }

            ViewBag.CurrentPage = "manage";
            ViewBag.BrowseMode  = "newest";

            // Reset to 0 if negative or null
            int afterSpray = after ?? 0;

            if (afterSpray < 0)
            {
                afterSpray = 0;
            }

            SprayListModel sprays = new SprayListModel();

            sprays.Start = afterSpray;
            sprays.Prev  = afterSpray - SPRAYS_PER_PAGE < 0 ? 0 : afterSpray - SPRAYS_PER_PAGE;

            using (var db = new SprayContext())
            {
                sprays.Sprays = db.Sprays.Where(s => s.Status == Status.UNMODERATED).OrderBy(s => s.DateAdded).Skip(afterSpray).Take(SPRAYS_PER_PAGE).ToList();
            }

            sprays.Next = sprays.Sprays.Count < SPRAYS_PER_PAGE ? afterSpray : afterSpray + SPRAYS_PER_PAGE;

            return(View(sprays));
        }
Beispiel #3
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            SprayListModel sprays = new SprayListModel();

            //sprays.Start = 0;
            //sprays.Prev = 0;

            //using (var db = new SprayContext())
            //{
            //    sprays.Sprays = db.Sprays.Where(s => s.Safeness == Safeness.SFW).Where(s => s.Status == Status.PUBLIC).OrderByDescending(s => s.DateAdded).Take(3).ToList();
            //}

            //sprays.Next = 0;

            return(View(sprays));
        }