public ActionResult Create(Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create(Guest guest) { if (ModelState.IsValid) { db.Guests.Add(guest); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guest)); }
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)); }
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)); }
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)); }
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!")); }