public async Task <CompanyTypeResponse> AddCompanyTypeAsync(AddCompanyTypeRequest request) { CompanyType companyType = _companyTypeMapper.Map(request); CompanyType result = _companyTypeRespository.Add(companyType); int modifiedRecords = await _companyTypeRespository.UnitOfWork.SaveChangesAsync(); _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords); _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id); return(_companyTypeMapper.Map(result)); }
public async Task <RespContainer <CompanyTypeResponse> > Handle(AddCompanyTypeCommand request, CancellationToken cancellationToken) { Models.CompanyType companyType = _companyTypeMapper.Map(request.Data); Models.CompanyType result = _companyTypeRespository.Add(companyType); int modifiedRecords = await _companyTypeRespository.UnitOfWork.SaveChangesAsync(); _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords); _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id); return(RespContainer.Ok(_companyTypeMapper.Map(result), "CompanyType Created")); }