Пример #1
0
        public ActionResult Login(WorkshopLoginModel objCustmerLoginModel)
        {
            ActionResult result = View();

            if (ModelState.IsValid)
            {
                var currentUser = objMechAppProjectEntities.Customers.FirstOrDefault(x => x.Login == objCustmerLoginModel.Login && x.Password == objCustmerLoginModel.Password);

                if (currentUser != null)
                {
                    Session["Login"] = new SessionModel()
                    {
                        UserId = currentUser.CustomerId, UserLogin = currentUser.Login
                    };
                    result = RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("Error", "Login i haslo nie są poprawne");
                    result = View("Login");
                }
            }

            return(result);
        }
Пример #2
0
        public ActionResult Login()
        {
            WorkshopLoginModel objCustmerLoginModel = new WorkshopLoginModel();

            return(View(objCustmerLoginModel));
        }
Пример #3
0
        public ActionResult LoginWorkshop()
        {
            WorkshopLoginModel objWorkshopLoginModel = new WorkshopLoginModel();

            return(View(objWorkshopLoginModel));
        }