Ejemplo n.º 1
0
        public ActionResult LoginFormSubmit()
        {
            var email    = Request["email"];
            var password = Request["password"];
            var UserType = Request["UserType"];

            if (UserType.Contains("gamer"))
            {
                bool isHave = db.Gamers.Any(u => u.Email == email &&
                                            u.Passward == password);
                if (!isHave)
                {
                    return(Content("No user Found"));
                }
                else
                {
                    Gamer gamer = db.Gamers.Where(u => u.Email == email &&
                                                  u.Passward == password).SingleOrDefault();
                    AuthUser.setGamerInCookie(gamer.GamerId + "");
                    return(RedirectToAction("ProfileView", "Home", new { id = gamer.GamerId }));
                }
            }
            else if (UserType.Contains("organizer"))
            {
                bool isHave = db.Organizer.Any(u => u.Organizeremail == email &&
                                               u.Passward == password);
                if (!isHave)
                {
                    return(Content("No user Found"));
                }
                else
                {
                    Organizer organizer = db.Organizer.Where(u => u.Organizeremail == email &&
                                                             u.Passward == password).SingleOrDefault();

                    AuthUser.setOrganizerInCookie(organizer.Organizerid + "");
                    return(RedirectToAction("Organizerprofileview", "Home", new { id = organizer.Organizerid }));
                }
            }
            return(null);
            //return RedirectToAction("ProfileView", "Home", new { id = gamer.GamerId });

            /*return RedirectToAction("Organizerprofileview", "Home", new { id = organizer.Organizerid });
             * return RedirectToAction("","");*/
        }