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); }
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); }
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); }