public async Task <WasteTypes> HandleAsync(GetImportNotificationWasteTypes message) { var wasteTypes = await wasteTypeRepository.GetByNotificationId(message.ImportNotificationId); var wasteCodeData = (await wasteCodeRepository.GetAllWasteCodes()).Select(wasteCode => mapper.Map <WasteCodeData>(wasteCode)) .ToList(); return(mapper.Map <WasteTypes>(wasteTypes, wasteCodeData)); }
public async Task <Guid> HandleAsync(UpdateImportNotificationWasteTypes message) { var currentWasteType = await wasteTypeRepository.GetByNotificationId(message.ImportNotificationId); var codes = mapper.Map <UpdateWasteCodeData>(message.WasteTypes); currentWasteType.Update(codes.Name, codes.BaselOecdCode, codes.EwcCode, codes.YCode, codes.HCode, codes.UnClass); await context.SaveChangesAsync(); return(currentWasteType.Id); }