Пример #1
0
        public ActionResult ApplyPermit()
        {
            UserRepository UR = new UserRepository();

            ViewData["Vehicle.VehicleMake.VehicleMakeID"] = new SelectList(UR.VehilceMakeList(), "VehicleMakeID", "MakeName");
            ViewData["Vehicle.VehicleColor.VehicleColorID"] = new SelectList(UR.VehicleColorList(), "VehicleColorID", "ColorName");
            ViewData["Vehicle.State.StateID"] = new SelectList(UR.StateList(), "StateID", "State");

            return View();
        }
Пример #2
0
        public ActionResult ApplyPermit(VVehiclePermit VehiclePermt)
        {
            if (ModelState.IsValid)
            {
                UserRepository UR = new UserRepository();
                UR.CreatePermit(VehiclePermt);
                return null;

            }

            return View(VehiclePermt);
        }
 protected override bool AuthorizeCore(HttpContextBase httpContext)
 {
     bool authorize = false;
     using (oversiiEntities db = new oversiiEntities())
     {
         UserRepository UM = new UserRepository();
         foreach (var roles in userAssignedRoles)
         {
             authorize = UM.IsUserInRole(httpContext.User.Identity.Name, roles);
             if (authorize)
                 return authorize;
         }
     }
     return authorize;
 }
Пример #4
0
        public ActionResult LogIn(UserLoginView ULV, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                UserRepository UM = new UserRepository();
                var CurrUSer = UM.AuthenticateUser(ULV.Email, ULV.Password);
                if ((bool)CurrUSer.IsLoginSuccess)
                {
                    FormsAuthentication.SetAuthCookie(ULV.Email, false);
                    var role = CurrUSer.Role;
                    return RedirectToAction("DashBoard", role);
                }
                else if (!(bool)CurrUSer.IsLoginSuccess)
                {
                    ModelState.AddModelError("", "The user login or password provided is incorrect.");
                    return View(ULV);
                }
                else
                    return View(ULV);

            }
            else
                return View();
        }