Пример #1
0
        public async Task Listar_FiltraCorrectamenteCheckOutsDeHoy()
        {
            var hoy = new DateTime(2020, 10, 18);

            AgregarReservaDeUnaCamaParaLaFecha(new DateTime(2020, 10, 15), new DateTime(2020, 10, 16), ReservaEstadoEnum.InHouse);
            AgregarReservaDeUnaCamaParaLaFecha(new DateTime(2020, 10, 16), new DateTime(2020, 10, 17), ReservaEstadoEnum.InHouse);
            AgregarReservaDeUnaCamaParaLaFecha(new DateTime(2020, 10, 17), hoy, ReservaEstadoEnum.InHouse);
            var listado = await _repository.Listar(ReservaEstadoEnum.InHouse, null, null, hoy, hoy);

            listado.Count().Should().Be(1);
        }
        public async Task <ActionResult <List <Reserva> > > Get()
        {
            var reservas = await _repositorio.Listar();

            if (reservas == null)
            {
                return(NotFound());
            }
            return(reservas);
        }
        public async Task <ActionResult <List <Reserva> > > Get()
        {
            var reservas = await _repositorio.Listar();

            if (reservas == null)
            {
                return(NotFound(new { mensagem = "Reserva não encontrada", Erro = true }));
            }
            return(reservas);
        }
        public async Task <ActionResult <List <Reserva> > > Get()
        {
            //FindAsync = procurar algo especifico no banco
            //await espera acontecer
            var reservas = await _repositorio.Listar();

            if (reservas == null)
            {
                return(NotFound());
            }

            return(reservas);
        }