示例#1
0
        public async Task <IActionResult> OnPostGetAvailableRoomsAsync(DateTime startDate, DateTime endDate)
        {
            //ItemList = await _itemApi.GetItems();
            ReservationList = await _reservationApi.GetReservations();

            ReservationList = ReservationList.Where(b => (b.StartDate > startDate && b.StartDate < endDate) || (b.EndDate > startDate) && b.EndDate < endDate).ToList();

            RoomList = await _roomApi.GetRooms();

            RoomList = RoomList.Where(x => ReservationList.Where(y => y.RoomId == x.Id).ToList().Count == 0).ToList();

            Rooms = RoomList.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id
            }).ToList();

            TempData["startDate"] = startDate;
            TempData["endDate"]   = endDate;

            return(Page());
        }
        private void ShowTimeTable(DateTime selectedDate)
        {
            IEnumerable <ReservationVo> necessaryList;

            for (int k = 0; k < StylistList.Count; k++) //미용사 리스트를 가져와서 한명씩 실행
            {
                _row = _dataTable.NewRow();             //DataRow를 생성해서 그 사람의 예약 테이블을 채워야지

                _row["StylistName"] = StylistList[k].StylistName;
                //_dataTable.Rows.Add(_row["StylistName"].ToString());

                //예약 목록 중 StylistId와 StylistList[k].StylistId가 일치하는 사람 찾아서 예약목록 불러오기
                necessaryList = ReservationList.Where(x => x.StylistId == StylistList[k].StylistId);

                //이 목록 중에서 선택한 날짜만 다시 불러오기
                necessaryList = necessaryList.Where(x => x.StartAt.ToString("d").Equals(selectedDate.ToString("d")));


                //SaveResInColumn(necessaryList);
                SaveResInColumn.SaveReservationInColumn(necessaryList, _dataTable, _row);
            }
        }