public IHttpActionResult BookRoom(BookRoomParam param) { var service = new HackExchangeService(); HackExchangeContext context = new HackExchangeContext() { Credentials = new NetworkCredential("*****@*****.**", "%baG7cadence"), Endpoint = "https://outlook.office365.com/EWS/Exchange.asmx" }; var rooms = service.GetRooms(context).Where(r => r.Location == "Montevideo, Uruguay" || r.Location == "Montevideo"); RoomAvailability availability = service.GetRoomAvailability(context, "*****@*****.**", null, 60, true); // If there is room available var bookResult = new BookResult() { Booked = true, Room = rooms.First(), Start = DateTime.Now, End = DateTime.Now.AddMinutes(param.Time)}; // If there is not, then it will find a possible slot. var negativeResult = new BookResult() { Booked = false, Room = rooms.First(), Start = DateTime.Now.AddMinutes(10), End = DateTime.Now.AddMinutes(param.Time) }; return Ok(negativeResult); }
public IHttpActionResult BookThisRoom(BookResult book) { book.Booked = true; return Ok(book); }