Exemplo n.º 1
0
        public IActionResult Photo(int PhotoId)
        {
            int?LoggedId = HttpContext.Session.GetInt32("UserId");

            if (LoggedId == null)
            {
                return(RedirectToAction("LogReg"));
            }

            GreatSmilesWrapper GMod = new GreatSmilesWrapper();

            GMod.AllPhotos = DbContext.DbPhotos
                             .Include(w => w.Official)
                             .Include(w => w.PhotoSmilers)
                             .ThenInclude(r => r.Voter)
                             .Where(w => w.PhotoId == PhotoId)
                             .ToList();
            GMod.UserForm = DbContext.DbUsers
                            .FirstOrDefault(u => u.UserId == (int)LoggedId);

            if (GMod == null)
            {
                return(RedirectToAction("Dashboard"));
            }
            return(View("Photo", GMod));
        }
Exemplo n.º 2
0
        public IActionResult UserDetail(int id)
        {
            int?LoggedUser = HttpContext.Session.GetInt32("UserId");

            if (LoggedUser == null)
            {
                return(RedirectToAction("LogReg", "Credentials"));
            }

            GreatSmilesWrapper SMod = new GreatSmilesWrapper();

            // SMod.UserForm = DbContext.DbUsers
            //     .Include(u => u.FirstName)
            //     .Include(u => u.UserStory)
            //     .Include(u => u.AllPhotos)
            //     .ThenInclude(p => p.PhotoName)
            //     .ToList();

            // if (ToShow == null)
            // {
            //     return RedirectToAction("Shows", SMod);
            // }


            return(View("UserDetail"));
        }
Exemplo n.º 3
0
        public IActionResult Leaderboard()
        {
            int?LoggedId = HttpContext.Session.GetInt32("UserId");

            if (LoggedId == null)
            {
                return(RedirectToAction("LogReg"));
            }

            GreatSmilesWrapper WMod = new GreatSmilesWrapper()
            {
                AllPhotos = DbContext.DbPhotos
                            .Include(w => w.Official)
                            .Include(w => w.PhotoSmilers)
                            .ThenInclude(r => r.Voter)
                            .ToList(),
                AllCompetitions = DbContext.DbCompetitions
                                  .Include(c => c.AllEntrants)
                                  .ToList(),
                AllEntrants = DbContext.DbEntrants
                              .ToList(),
                UserForm = DbContext.DbUsers
                           .FirstOrDefault(u => u.UserId == (int)LoggedId)
            };

            return(View("Leaderboard", WMod));
        }