Exemple #1
0
        public ActionResult GamerCompitionList()
        {
            HttpCookie myCookie = AuthUser.getUserType();

            if (myCookie.Value.Contains("gamer"))
            {
                Gamer  gm       = AuthUser.getGamerUser();
                string gameName = gm.Prefferedgame;

                IEnumerable <Competition> competitions = db.Competition.Where(u => u.GameName.Contains(gameName));

                return(View(competitions));
            }
            else if (myCookie.Value.Contains("organizer"))
            {
                return(RedirectToAction("Error"));
            }
            return(Content("Somthing Goes Wrong"));
        }
Exemple #2
0
        public ActionResult DashBoard()
        {
            System.Diagnostics.Debug.WriteLine(AuthUser.isAdminLogIn());
            if (AuthUser.isAdminLogIn())
            {
                HttpCookie myCookie = AuthUser.getUserType();

                if (myCookie.Value.Contains("gamer"))
                {
                    Gamer gm = AuthUser.getGamerUser();
                    return(RedirectToAction("ProfileView", "Home", new { id = gm.GamerId }));
                }
                if (myCookie.Value.Contains("organizer"))
                {
                    Organizer or = AuthUser.getOrganizerUser();
                    return(RedirectToAction("Organizerprofileview", "Home", new { id = or.Organizerid }));
                }
            }
            else
            {
                return(RedirectToAction("Logout"));
            }
            return(null);
        }
Exemple #3
0
        public ActionResult GiveReviewForm()
        {
            string type   = Request["type"];
            string email  = Request["email"];
            string rating = Request["rating"];

            if (email == null || email == "")
            {
                return(Content("Please Give Email"));
            }

            HttpCookie myCookie = AuthUser.getUserType();

            if (myCookie.Value.Contains("gamer"))
            {
                Gamer gm = AuthUser.getGamerUser();
                if (type.Contains("gamer"))
                {
                    return(Content("You Can not review Gammer"));
                }
                else
                {
                    Organizer gn = db.Organizer.Where(u => u.Organizeremail == email).SingleOrDefault();
                    if (gn == null)
                    {
                        return(Content("Please Give Correct User email"));
                    }
                    else
                    {
                        gn.rating       += Convert.ToInt32(rating);
                        gn.reviewmember += 1;
                        db.SaveChanges();
                    }
                }
                return(RedirectToAction("ProfileView", "Home", new { id = gm.GamerId }));
            }
            if (myCookie.Value.Contains("organizer"))
            {
                Organizer or = AuthUser.getOrganizerUser();

                if (type.Contains("organizer"))
                {
                    return(Content("You Can not review Organizer"));
                }
                else
                {
                    Gamer gn = db.Gamers.Where(u => u.Email == email).SingleOrDefault();
                    if (gn == null)
                    {
                        return(Content("Please Give Correct User email"));
                    }
                    else
                    {
                        gn.rating       += Convert.ToInt32(rating);
                        gn.reviewmember += 1;
                        db.SaveChanges();
                    }
                }
                return(RedirectToAction("Organizerprofileview", "Home", new { id = or.Organizerid }));
            }

            return(Content("Thank you giving rating email " + email));
        }