示例#1
0
        public ActionResult signup(SOUND_SYSTEM.Model.userdata p)
        {
            userdata si = mdi.userdatas.Where(x => x.Username == p.Username).SingleOrDefault();

            if (si == null)
            {
                mdi.userdatas.Add(p);
                mdi.SaveChanges();
                Session["uname"] = p.Username;
                return(Redirect("/Home/Index"));
            }
            else
            {
                ViewBag.Error = "Username Already Exists ......";
                return(View("signup"));
            }
        }
示例#2
0
        public ActionResult Validatesignin(SOUND_SYSTEM.Model.userdata p)
        {
            userdata si = mdi.userdatas.Where(x => x.Email == p.Email).SingleOrDefault();

            if (si != null)
            {
                if ((si.Email == p.Email) && (si.Password == p.Password))
                {
                    Session["uname"] = p.Username;

                    return(Redirect("/Admin/Index"));
                }
                else
                {
                    ViewBag.Error = " Incorrect Username and Password";
                    return(View("login"));
                }
            }
            else
            {
                ViewBag.Error = " Incorrect Username and Password";
            }
            return(View("login"));
        }