public async Task <bool> Add(CommandLine command) { command.Id = Guid.NewGuid().ToString(); await _commandContext.AddAsync(command); return(await _commandContext.SaveChangesAsync() >= 0); }
public async Task Handle(Command request, CancellationToken cancellationToken) { var entity = Mapper.Map <Order>(request); await _context.AddAsync(entity, cancellationToken); await _context.SaveChangesAsync(cancellationToken); await _mediator.Publish(new Completed(request, entity)); }