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")); }
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)); }