示例#1
0
        public async Task <ActionResult <int> > Count([FromBody] Reservation_ReservationFilterDTO Reservation_ReservationFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            ReservationFilter ReservationFilter = ConvertFilterDTOToFilterEntity(Reservation_ReservationFilterDTO);
            int count = await ReservationService.Count(ReservationFilter);

            return(count);
        }
示例#2
0
        public async Task <ActionResult <List <Reservation_ReservationDTO> > > List([FromBody] Reservation_ReservationFilterDTO Reservation_ReservationFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            ReservationFilter  ReservationFilter = ConvertFilterDTOToFilterEntity(Reservation_ReservationFilterDTO);
            List <Reservation> Reservations      = await ReservationService.List(ReservationFilter);

            List <Reservation_ReservationDTO> Reservation_ReservationDTOs = Reservations
                                                                            .Select(c => new Reservation_ReservationDTO(c)).ToList();

            return(Reservation_ReservationDTOs);
        }
示例#3
0
        private ReservationFilter ConvertFilterDTOToFilterEntity(Reservation_ReservationFilterDTO Reservation_ReservationFilterDTO)
        {
            ReservationFilter ReservationFilter = new ReservationFilter();

            ReservationFilter.Selects   = ReservationSelect.ALL;
            ReservationFilter.Skip      = Reservation_ReservationFilterDTO.Skip;
            ReservationFilter.Take      = Reservation_ReservationFilterDTO.Take;
            ReservationFilter.OrderBy   = Reservation_ReservationFilterDTO.OrderBy;
            ReservationFilter.OrderType = Reservation_ReservationFilterDTO.OrderType;

            ReservationFilter.Id       = Reservation_ReservationFilterDTO.Id;
            ReservationFilter.TableId  = Reservation_ReservationFilterDTO.TableId;
            ReservationFilter.Date     = Reservation_ReservationFilterDTO.Date;
            ReservationFilter.StatusId = Reservation_ReservationFilterDTO.StatusId;
            return(ReservationFilter);
        }