예제 #1
0
 public ActionResult Autherize(Car_rental.Models.uzytkownicy userModel)
 {
     using (CarRentalDBEntities db = new CarRentalDBEntities())
     {
         var userDetails = db.uzytkownicy.Where(x => x.Login == userModel.Login && x.Haslo == userModel.Haslo).FirstOrDefault();
         if (userDetails == null)
         {
             return(View("Index", userModel));
         }
         else
         {
             Session["Login"]         = userDetails.Login;
             Session["Rola"]          = userDetails.Rola;
             Session["Id_uzytkownik"] = userDetails.Id_uzytkownik;
             return(RedirectToAction("Konto", "Home"));
         }
     }
 }
예제 #2
0
 public CarRentalDBEntities Init()
 {
     return(dbContext ?? (dbContext = new CarRentalDBEntities()));
 }