public async Task <HttpResponseMessage> BookCalandar(CalendarInputForBooking inputForRoomBooking) { CalendarInput input = new CalendarInput(); CalendarOutputForBooking output = new CalendarOutputForBooking(); input.BookingSlots = inputForRoomBooking.BookingSlots.Select( q => new Slot() { StartDateTime = q.StartDateTime, EndDateTime = q.EndDateTime }).ToList(); input.Capacity = inputForRoomBooking.Capacity; input.FloorID = inputForRoomBooking.FloorID; input.UserId = inputForRoomBooking.UserId; input.Password = inputForRoomBooking.Password; GetFloorAndRooms getFloorAndRooms = new GetFloorAndRooms(); IList <CalendarOutput> calendarOutputList = getFloorAndRooms.GetRoomsAvailabilityByCalendateInput(System.Configuration.ConfigurationManager.AppSettings["Connection"], input); if (calendarOutputList.Count > 0 && !(calendarOutputList.Any(t => t.IsAvailable == false))) { output = getFloorAndRooms.BookRooms(System.Configuration.ConfigurationManager.AppSettings["Connection"], inputForRoomBooking); } else { output.Message = "Conflict occured for provided slots against system bookings."; } return(Request.CreateResponse(HttpStatusCode.OK, output)); }
public async Task <HttpResponseMessage> FetchBookings(CalendarInput input) { GetFloorAndRooms getFloorAndRooms = new GetFloorAndRooms(); IList <CalendarOutput> calendarOutputList = getFloorAndRooms.GetRoomsAvailabilityByCalendateInput(System.Configuration.ConfigurationManager.AppSettings["Connection"], input); return(Request.CreateResponse(HttpStatusCode.OK, calendarOutputList)); }