public async Task <HttpResponseMessage> GetRoomsByFloorId([FromUri] int floorID)
        {
            GetFloorAndRooms getFloorAndRooms = new GetFloorAndRooms();
            IList <Room>     roomList         = getFloorAndRooms.GetRoomsByFloorID(System.Configuration.ConfigurationManager.AppSettings["Connection"], floorID);

            return(Request.CreateResponse(HttpStatusCode.OK, roomList));
        }
        public HttpResponseMessage GetFloors()
        {
            GetFloorAndRooms getFloorAndRooms = new GetFloorAndRooms();
            IList <Floor>    floorList        = getFloorAndRooms.GetFloorList(System.Configuration.ConfigurationManager.AppSettings["Connection"]);

            return(Request.CreateResponse(HttpStatusCode.OK, floorList));
        }
        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));
        }
 public async Task <HttpResponseMessage> ValidateUserForOutlookConnection(UserLoginInfo user)
 {
     try
     {
         GetFloorAndRooms getFloorAndRooms = new GetFloorAndRooms();
         bool             returnVal        = getFloorAndRooms.CheckExchangeServiceForProvidedUserDetails(user.userName, user.password);
         if (returnVal)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, returnVal));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, false));
         }
     }
     catch
     {
         return(Request.CreateResponse(HttpStatusCode.NotFound, false));
     }
 }