예제 #1
0
        public async Task <RespContainer <ArticleGroupResponse> > Handle(AddArticleGroupCommand request, CancellationToken cancellationToken)
        {
            Models.ArticleGroup articleGroup = _articleGroupMapper.Map(request.Data);
            Models.ArticleGroup result       = _articleGroupRespository.Add(articleGroup);

            int modifiedRecords = await _articleGroupRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(RespContainer.Ok(_articleGroupMapper.Map(result), "ArticleGroup Created"));
        }
예제 #2
0
        public async Task <ArticleGroupResponse> AddArticleGroupAsync(AddArticleGroupRequest request)
        {
            ArticleGroup articleGroup = _articleGroupMapper.Map(request);
            ArticleGroup result       = _articleGroupRespository.Add(articleGroup);

            int modifiedRecords = await _articleGroupRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(_articleGroupMapper.Map(result));
        }