Example #1
0
        public ActionResult UserProfile(string username)
        {
            iCheckContext context = new iCheckContext();

            var uInfo = from x in context.Users
                        where x.Username == username
                        select x;

            var gc = (from x in context.Users
                      where x.Username == username
                      select x).Single();

            var steam64 = from x in context.Users
                          where x.Username == username
                          select x.Steam64;

            foreach (var s64 in steam64)
            {
                TempData["Steam64"] = s64;
            }

            ViewBag.user   = uInfo;
            ViewBag.whoami = username;
            User u = gc;

            ViewBag.gc = u.GamesChecked.Count();

            return(View());
        }
        public ActionResult GameProfile(string gameID)
        {
            iCheckContext context = new iCheckContext();

            TempData["CurrentUrl"] = Request.Url.ToString();
            string[] split = Request.Url.ToString().Split('/');
            var      gid   = split.Last();

            try
            {
                var checks4thisGame = (from x in context.Games
                                       where x.GBID == gid
                                       select x).Single();
                Game g = checks4thisGame;
                ViewBag.gg = g.UserCheck.Count();
            }
            catch (Exception)
            {
                return(View());
            }



            return(View());
        }
Example #3
0
        public ActionResult Register()
        {
            string iuName    = Request["UserName"];
            string iEmail    = Request["Email"];
            string iFName    = Request["FName"];
            string iLname    = Request["LName"];
            string iDoB      = Request["DoB"];
            string iCountry  = Request["Country"];
            string iSteamID  = Request["Steam64"];
            string password1 = Request["Password"];
            string password2 = Request["PasswordCheck"];

            iCheckContext context = new iCheckContext();

            ViewBag.userTaken    = null;
            ViewBag.MissPaswword = null;
            foreach (User u in context.Users)
            {
                if (iuName == u.Username || iuName == "")
                {
                    ViewBag.userTaken = "Username taken";
                }
                if (password1 != password2)
                {
                    ViewBag.MissPassword = "******";
                }
            }
            DateTime convertDoB = Convert.ToDateTime(iDoB);

            if (ViewBag.userTaken == null && ViewBag.MissPassword == null)
            {
                context.Users.Add(new User {
                    Username  = iuName,
                    Email     = iEmail,
                    FirstName = iFName,
                    LastName  = iLname,
                    DoB       = convertDoB,
                    Country   = iCountry,
                    Steam64   = iSteamID
                });

                context.SaveChanges();
                Session["IsLoggedIn"]  = true;
                Session["UserName"]    = iuName;
                Session["CurrentUser"] = Session["UserName"];
            }


            return(Redirect("/"));
        }
        // GET: Check
        public ActionResult Index()
        {
            string currUser    = Session["UserName"].ToString();
            string gamechecked = Request["checkBTN"];

            string[] split    = gamechecked.Split('/');
            var      gameID   = split.Last();
            var      gameName = split.First();

            iCheckContext context = new iCheckContext();

            var gameInDB = from x in context.Games
                           where x.GBID == gameID
                           select x;


            if (gameInDB.Count() < 1)
            {
                context.Games.Add(new Game
                {
                    GBID = gameID,
                    Name = gameName
                });
            }
            context.SaveChanges();

            var addThisGame = (from x in context.Games
                               where x.Name == gameName
                               select x).Single();


            var toThisUser = (from x in context.Users
                              where x.Username == currUser
                              select x).Single();


            User u = toThisUser;


            if (!u.GamesChecked.Contains(addThisGame))
            {
                u.GamesChecked.Add(addThisGame);
            }



            context.SaveChanges();

            return(Redirect("/"));
        }
        // GET: GamePage
        public ActionResult Game()
        {
            var searchValue = Request.QueryString["search"];

            ViewBag.sq = searchValue;

            using (iCheckContext context = new iCheckContext())
            {
                int count = context.Users.Count();
                ViewBag.numUsers = count;
            }


            return(View());
        }
Example #6
0
        public ActionResult Login()
        {
            string uName    = Request["LoginUserName"];
            string password = Request["LoginPassword"];

            iCheckContext context = new iCheckContext();

            foreach (User u in context.Users)
            {
                if (uName == u.Username)
                {
                    if (password == u.Password)
                    {
                        Session["IsLoggedIn"]  = true;
                        Session["UserName"]    = uName;
                        Session["CurrentUser"] = Session["UserName"];
                    }
                }
            }

            return(Redirect("/"));
        }