コード例 #1
0
        public ScheduleItemDto GetById(int item_id)
        {
            try
            {
                var scheduleItem = _repository.GetById(item_id);

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

                _logger.LogInfo($"Returned ScheduleItem with id: {item_id}");

                var Result = _mapper.Map <ScheduleItemDto>(scheduleItem);
                return(Result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong inside GetScheduleItemById action: {ex.Message}");
                throw new Exception();
            }
        }