Beispiel #1
0
 public async Task DeleteAsync(Guid itemToDelete, CancellationToken cancellationToken = new CancellationToken())
 {
     using (var uow = new GreetingContext(_options))
     {
         var repository = new GreetingRepositoryAsync(uow);
         await repository.DeleteAsync(itemToDelete, cancellationToken);
     }
 }
Beispiel #2
0
 public async Task AddAsync(Guid id, string message, CancellationToken cancellationToken = new CancellationToken())
 {
     using (var uow = new GreetingContext(_options))
     {
         var repository = new GreetingRepositoryAsync(uow);
         var savedItem  = await repository.AddAsync(new Greeting { Id = id, Message = message }, cancellationToken);
     }
 }
        public override async Task <DeleteGreetingCommand> HandleAsync(DeleteGreetingCommand command, CancellationToken cancellationToken = new CancellationToken())
        {
            using (var uow = new GreetingContext(_options))
            {
                var repository = new GreetingRepositoryAsync(uow);
                await repository.DeleteAsync(command.Id, cancellationToken);
            }


            return(await base.HandleAsync(command, cancellationToken));
        }
        public override async Task <AddGreetingCommand> HandleAsync(AddGreetingCommand command, CancellationToken cancellationToken = new CancellationToken())
        {
            using (var uow = new GreetingContext(_options))
            {
                var repository = new GreetingRepositoryAsync(uow);
                var savedItem  = await repository.AddAsync(
                    new Greeting { Id = command.Id, Message = command.Message },
                    cancellationToken
                    );
            }

            return(await base.HandleAsync(command, cancellationToken));
        }