Beispiel #1
0
        public override string[] GetRolesForUser(string username)
        {
            RideAppEntities db = new RideAppEntities();
            string          s  = db.tblUsers.Where(x => x.UserName == username).FirstOrDefault().Role;

            string[] results = { s };
            return(results);
        }
Beispiel #2
0
        public ActionResult Login(tblUser user)
        {
            RideAppEntities obj   = new RideAppEntities();
            var             count = obj.tblUsers.Where(x => x.UserName == user.UserName && x.Paasword == user.Paasword).Count();

            if (count == 0)
            {
                ViewBag.Msg = "Invalid User";
                return(View());
            }
            else
            {
                FormsAuthentication.SetAuthCookie(user.UserName, false);
                return(RedirectToAction("Index", "Home"));
            }
        }