Exemple #1
0
        public IQueryable<ComplejoModelResponse> GetAllComplejos()
        {
            try
            {
                var complejos = from complejo in complejoRepository.All
                                select complejo;

                List<ComplejoModelResponse> list = new List<ComplejoModelResponse>();
                list.Add(new ComplejoModelResponse()
                {
                    HttpStatusCode = 200,
                    HttpStatusDesc = "Ok",
                    Complejos = complejos
                });
                return list.AsQueryable();
            }
            catch (Exception ex)
            {
                List<ComplejoModelResponse> list = new List<ComplejoModelResponse>();
                list.Add(new ComplejoModelResponse()
                {
                    HttpStatusCode = 400,
                    HttpStatusDesc = "Bad Request",
                    Complejos = new List<Complejo>().AsQueryable(),
                    Exception = ex
                });

                return list.AsQueryable();
            }
        }
Exemple #2
0
        public IQueryable<ReservaModelResponse> GetAllReservasByDate(DateTime fechaHora)
        {
            try
            {
                var reservas = from reserva in reservaRepository.All
                                where reserva.FechaHora == fechaHora
                                select reserva;

                List<ReservaModelResponse> list = new List<ReservaModelResponse>();
                list.Add(new ReservaModelResponse()
                {
                    HttpStatusCode = 200,
                    HttpStatusDesc = "Ok",
                    Reservas = reservas
                });
                return list.AsQueryable();
            }
            catch (Exception ex)
            {
                List<ReservaModelResponse> list = new List<ReservaModelResponse>();
                list.Add(new ReservaModelResponse()
                {
                    HttpStatusCode = 400,
                    HttpStatusDesc = "Bad Request",
                    Reservas = new List<Reserva>().AsQueryable(),
                    Exception = ex
                });
                return list.AsQueryable();

            }
        }