Exemple #1
0
        public async Task <ActionResult <CampModel[]> > SearchByDate(DateTime date, bool includeTaks = false)
        {
            var results = await _repository.GetAllCampsByEventDate(date, includeTaks);

            if (!results.Any())
            {
                return(NotFound());
            }
            return(_mapper.Map <CampModel[]>(results));
        }
        public async Task <ActionResult <CampModel[]> > SearchByDate(DateTime theDate, bool includeTalks = false)
        {
            try
            {
                var results = await _campRepository.GetAllCampsByEventDate(theDate, includeTalks);

                return(!results.Any() ? (ActionResult)NotFound() : Ok(_mapper.Map <CampModel[]>(results)));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure{ex.Message}"));
            }
        }
        public async Task <IHttpActionResult> SearchByEventDate(DateTime eventDate, bool includeTalks = false)
        {
            try
            {
                //var dt = DateTime.ParseExact(eventDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                var result = await _repository.GetAllCampsByEventDate(eventDate, includeTalks);

                return(Ok(_mapper.Map <CampModel[]>(result)));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public async Task <ActionResult> SearchByEventDate(DateTime eventDate, bool includeTalks = false)
        {
            try
            {
                var result = await _campRepository.GetAllCampsByEventDate(eventDate, includeTalks);

                var mappedResult = _mapper.Map <IEnumerable <CampModel> >(result);

                return(Ok(mappedResult));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
        public async Task <IHttpActionResult> SearchCampsByEventDate(DateTime eventDate, bool includeTalks = false)
        {
            Camp[] result;

            try
            {
                result = await _repository.GetAllCampsByEventDate(eventDate, includeTalks);             // on searching we shouldn't return NotFound. An empty Collection is fine...
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            CampDto[] mappedResult = _mapper.Map <CampDto[]>(result);
            return(Ok(mappedResult));
        }
Exemple #6
0
        public async Task <ActionResult <CampModel[]> > SearchByDate(DateTime theDate, bool includeTalks = false)
        {
            try
            {
                var results = await _campRepository.GetAllCampsByEventDate(theDate, includeTalks);

                if (!results.Any())
                {
                    return(NotFound());
                }
                return(_mapper.Map <CampModel[]>(results));
            }
            catch (Exception)
            {
                return(StatusCode(500, "Database Failure"));
            }
        }
Exemple #7
0
        public async Task <ActionResult <CampModel[]> > SearchByDate(DateTime theDate, bool includeTalks = false)
        {
            try
            {
                var result = await _campRepository.GetAllCampsByEventDate(theDate, includeTalks);

                if (!result.Any())
                {
                    return(NotFound());
                }
                return(_mapper.Map <CampModel[]>(result));
            }
            catch (Exception)
            {
                return(BadRequest("Database Error"));
            }
        }
        public async Task <ActionResult <CampDTO[]> > SearchByDate(DateTime eventDate, bool includeTalks = false)
        {
            try
            {
                var result = await _repo.GetAllCampsByEventDate(eventDate, includeTalks);

                if (!result.Any())
                {
                    return(NotFound());
                }
                var camps = _mapper.Map <CampDTO[]>(result);
                return(camps);
            }
            catch (Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "DB error"));
            }
        }
        public async Task <ActionResult <CampModel[]> > GetAllCampsByEventDate(DateTime eventDate, bool includeTalks = false)
        {
            try
            {
                var results = await _repository.GetAllCampsByEventDate(eventDate, includeTalks);

                if (!results.Any())
                {
                    return(NotFound());
                }

                return(_mapper.Map <CampModel[]>(results));
            }
            catch
            {
                return(StatusCode(StatusCodes.Status404NotFound));
            }
        }
        public async Task <ActionResult <CampModel[]> > SearchDate(DateTime theDate, bool inludeTalks = false)
        {
            try
            {
                var results = await _repository.GetAllCampsByEventDate(theDate, inludeTalks);

                if (!results.Any())
                {
                    return(NotFound());
                }

                return(_mapper.Map <CampModel[]>(results));
            }
            catch (Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Error en la base de datos"));
            }
        }
        public async Task <IHttpActionResult> SearchByDateTimeEvent(DateTime dateTime, bool includeTalks = false)
        {
            try
            {
                var rs = await cr.GetAllCampsByEventDate(dateTime, includeTalks);

                var mr = mp.Map <IEnumerable <CampModel> >(rs);
                if (null == mr || 0 >= mr.Count())
                {
                    return(NotFound());
                }
                return(Ok(mr));
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }
            return(BadRequest("NF"));
        }
Exemple #12
0
        public async Task <ActionResult <Camp[]> > SearchByDate(DateTime theDate, bool includeTalks = false)
        {
            try
            {
                var results = await _repository.GetAllCampsByEventDate(theDate, includeTalks);

                if (!results.Any())
                {
                    return(NotFound());
                }

                return(results);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }
        }
Exemple #13
0
        //http://localhost:6600/api/camps/BuscarCampamentoPorFecha?fecha=2018-10-18
        //http://localhost:6600/api/camps/BuscarCampamentoPorFecha?fecha=2018-10-18&incluyeModeloTalk=true
        public async Task <ActionResult <ModeloCampamento[]> > BuscarCampamentoPorFecha(DateTime fecha, bool incluyeModeloTalk = false)
        {
            try
            {
                var resultado = await campamentoRepositorio.GetAllCampsByEventDate(fecha, incluyeModeloTalk);

                if (!resultado.Any())
                {
                    return(NotFound());
                }

                ModeloCampamento[] modeloCampamento = mapperRepositorio.Map <ModeloCampamento[]>(resultado);
                return(modeloCampamento);
            }
            catch (Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falla de la Base de Datos"));
            }
        }
        public async Task <ActionResult> SearchByDate(DateTime theDate, bool includeTalks = false)
        {
            try
            {
                var result = await _repository.GetAllCampsByEventDate(theDate, includeTalks);

                if (!result.Any())
                {
                    return(NotFound());
                }

                return(Ok(_mapper.Map <IEnumerable <CampModel> >(result)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed To Load Data. The following exception is thrown {ex}");
                return(BadRequest("Failed To Load Data"));
            }
        }