예제 #1
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
예제 #2
0
        public ActionResult Create(Guest guest)
        {
            if (ModelState.IsValid)
            {
                db.Guests.Add(guest);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(guest));
        }
예제 #3
0
        public ActionResult Create(Room room)
        {
            if (ModelState.IsValid)
            {
                db.Rooms.Add(room);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idEmployee = new SelectList(db.Employees, "idEmplyee", "Username", room.idEmployee);
            return(View(room));
        }
예제 #4
0
        public ActionResult Create(News news)
        {
            if (ModelState.IsValid)
            {
                db.News.Add(news);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idEmpoyee = new SelectList(db.Employees, "idEmplyee", "Username", news.idEmpoyee);
            return(View(news));
        }
예제 #5
0
        public ActionResult Create(Reservation reservation)
        {
            if (ModelState.IsValid)
            {
                db.Reservations.Add(reservation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idEmpoyee = new SelectList(db.Employees, "idEmplyee", "Username", reservation.idEmpoyee);
            ViewBag.idGuest   = new SelectList(db.Guests, "idGuest", "Username", reservation.idGuest);
            ViewBag.idRoom    = new SelectList(db.Rooms, "idRoom", "Status", reservation.idRoom);
            return(View(reservation));
        }
예제 #6
0
        public IHttpActionResult enterbooking(int room, DateTime sdate, DateTime edate, int numguests)
        {
            Reservation m = new Reservation();

            m.idRoom          = room;
            m.idGuest         = 1;
            m.idEmpoyee       = 1;
            m.ReservationDate = DateTime.Now;
            m.StartDate       = sdate;
            m.EndDate         = edate;
            m.NumOfGuests     = numguests;


            db.Reservations.Add(m);
            db.SaveChanges();

            return(Ok("Uspjesno rezervisano!"));
        }