コード例 #1
0
        public Error Save(ErrorDTO errorDTO)
        {
            try
            {
                var model = _mapper.Map <Error>(errorDTO);

                var category = _categoryManager.CategoryByName(errorDTO.Category);
                var level    = _levelManager.LevelByName(errorDTO.Level);

                model.Category = category;
                model.Level    = level;

                _errorRepository.Save(model);

                return(model);
            }
            catch (LevelNotFoundException)
            {
                throw new LevelNotFoundException();
            }
            catch (CategoryNotFoundException)
            {
                throw new CategoryNotFoundException();
            }
        }