Ejemplo n.º 1
0
        public RoomController(RoomBookingContext context)
        {
            _context = context;

            if (_context.Rooms.Count() == 0)
            {
                _context.Rooms.Add(new Room
                {
                    Location = "A302",
                    Floor    = 3,
                    Size     = 6,
                    Type     = RoomType.Group
                });
                _context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public ActionResult Login(LoginModel model)
        {
            RoomBookingContext a = new RoomBookingContext();

            var result = a.Users.SqlQuery($"SELECT * FROM dbo.Users WHERE Login = '******' AND Password = '******'").ToList();

            //var login = new SqlParameter("@login", model.Login);
            //var pass = new SqlParameter("@pass", model.Password);
            //var result = a.Users.SqlQuery($"SELECT * FROM dbo.Users WHERE Login = @login AND Password = @pass", login, pass).ToList();

            if (result.Count != 0)
            {
                FormsAuthentication.SetAuthCookie(result.FirstOrDefault().Login, true);
                return(RedirectToAction("Index", "Home"));
            }
            return(View(model));
        }
Ejemplo n.º 3
0
 public ReservationController(RoomBookingContext context)
 {
     _context = context;
 }
Ejemplo n.º 4
0
 public RoomService(RoomBookingContext _context)
 {
     context = _context;
 }
 public RoomBookingRepository()
 {
     db = new RoomBookingContext();
 }
 public RoomBookingAuthRepository()
 {
     db  = new RoomBookingContext();
     md5 = new MD5HashCalculating();
 }
 public AccountController(RoomBookingContext bokingDBContext)
 {
     _bokingDBContext = bokingDBContext;
 }
Ejemplo n.º 8
0
 public EFGenericRepository()
 {
     _context = new RoomBookingContext();
 }
Ejemplo n.º 9
0
 public RoomsController(RoomBookingContext bokingDBContext)
 {
     _bokingDBContext = bokingDBContext;
 }