Exemple #1
0
        public DatePlanningDto GetUpcomming(int event_id)
        {
            try
            {
                DatePlanning datePlanning = _repository.GetUpcomming(event_id);

                if (datePlanning == null)
                {
                    datePlanning = _repository.GetLast(event_id);
                }

                if (datePlanning == null)
                {
                    return(null);
                }

                DatePlanningDto datePlanningDto = _mapper.Map <DatePlanningDto>(datePlanning);

                return(datePlanningDto);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong inside DeleteDatePlanning action: {ex.Message}");
                throw new Exception();
            }
        }
        public IActionResult GetDatePlanningByid(int id)
        {
            try
            {
                DatePlanningDto datePlanning = _datePlanningLogic.GetById(id);

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

                return(Ok(datePlanning));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }
        public IActionResult GetDatePlanningByidWithDetails(int id)
        {
            try
            {
                DatePlanningDto datePlanning = _datePlanningLogic.GetByIdWithDetails(id);

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

                return(Ok(datePlanning));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong inside GetAll action: {ex.Message}");
                return(StatusCode(500, "Internal server error"));
            }
        }
        public IActionResult GetUpcommingEventDate(int event_id)
        {
            try
            {
                DatePlanningDto datePlanning = _datePlanningLogic.GetUpcomming(event_id);

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

                datePlanning.event_date         = _eventDateLogic.GetByDatePlanning(datePlanning.id);
                datePlanning.event_date.artists = _artistLogic.GetArtistsByEventDate(datePlanning.event_date.id);

                return(Ok(datePlanning));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }