// PUT api/<controller>/5 public IHttpActionResult Put(int idRB, string reason, RoomBookingView rbv) { var rb = new RoomBooking { IDBook = rbv.IDBook, IDRoom = rbv.IDRoom, IDRoomBook = rbv.IDRoomBook }; Repositories.UpdateRB(rb, reason); return(Ok()); }
// POST api/<controller> public IHttpActionResult Post(RoomBookingView rbv) { var rb = new RoomBooking { IDRoom = rbv.IDRoom, IDBook = rbv.IDBook }; Repositories.CreateRB(rb); return(Ok(rb)); }
public IHttpActionResult GetRB(int idRB) { var item = Repositories.RoomChange(idRB); var rbv = new RoomBookingView { IDRoom = item.IDRoom, IDBook = item.IDBook, IDRoomBook = item.IDRoomBook, NameRoom = item.Room.NameRoom }; return(Ok(rbv)); }
public JsonResult TakeRoom(RoomBookingView rbv) { HttpResponseMessage res = GlobalVariables.client.PostAsJsonAsync("RoomBooking", rbv).Result; return(Json(new { status = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateRB(RoomBookingView rbv, string reason, string token) { HttpResponseMessage res = GlobalVariables.client.PutAsJsonAsync("RoomBooking?idRB=" + rbv.IDRoomBook + "&reason=" + reason, rbv).Result; if (res.IsSuccessStatusCode) { TempData["success"] = "Room change successful"; } return(RedirectToAction("InformationBooking", new { token = token })); }
public ActionResult ChangeRoom(int idRB, string token) { HttpResponseMessage resBooking = GlobalVariables.client.GetAsync("Booking?token=" + token).Result; BookingView book = resBooking.Content.ReadAsAsync <BookingView>().Result; HttpResponseMessage resRoom = GlobalVariables.client.GetAsync("EmptyRoom/" + book.IDCateRoom.ToString()).Result; TempData["room"] = resRoom.Content.ReadAsAsync <IEnumerable <RoomView> >().Result; TempData["token"] = token; TempData["idBook"] = book.IDBooking; HttpResponseMessage resRB = GlobalVariables.client.GetAsync("RoomBooking?idRB=" + idRB.ToString()).Result; RoomBookingView rb = resRB.Content.ReadAsAsync <RoomBookingView>().Result; return(View(rb)); }