public async Task <ProductBasicsDto> Handle(Command request, CancellationToken cancellationToken) { //var productBase = new ProductBase(); //var entry = await _context.AddAsync(productBase); //entry.CurrentValues.SetValues(request.Dto); var productBase = _mapper.Map <ProductBase>(request.Dto); await _context.AddAsync(productBase); await _context.SaveChangesAsync(); return(_mapper.Map <ProductBasicsDto>(productBase)); }
public async Task <TransferOrderHeaderDto> CreateOrderHeaderAsync(TransferOrderHeaderDto dto) { dto.OrderTypeId = _context.OrderTypes.AsNoTracking().FirstOrDefault(o => o.Code == "LT").Id; dto.CreatedOn = DateTime.Now; Order order = new Order(); var entry = await _context.AddAsync(order); entry.CurrentValues.SetValues(dto); await _context.SaveChangesAsync(); dto.Id = order.Id; return(dto); }