Example #1
0
        public StageDto GetById(int stage_id)
        {
            try
            {
                var stage = _repository.GetById(stage_id);

                if (stage == null)
                {
                    _logger.LogError($"Stage with id: {stage_id}, hasn't been found in db.");
                    return(null);
                }

                _logger.LogInfo($"Returned Stage with id: {stage_id}");

                var Result = _mapper.Map <StageDto>(stage);
                return(Result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong inside GetStageById action: {ex.Message}");
                throw new Exception();
            }
        }
Example #2
0
        public IActionResult GetRouteWithStage(int stageId)
        {
            var stage = _stageRepository.GetById(stageId, s => s.Include(t => t.RouteStages));

            return(Ok(stage));
        }