Example #1
0
        public async Task <Unit> Handle(DeleteProductCommand request, CancellationToken cancellationToken)
        {
            Product product = await dbPocDbContext.Products.FindAsync(request.Id);

            dbPocDbContext.Remove(product);
            await dbPocDbContext.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
Example #2
0
        public async Task <Unit> Handle(DeleteRecipeCommand request, CancellationToken cancellationToken)
        {
            Recipe recipe = await dbPocDbContext.Recipes.FindAsync(request.Id);

            dbPocDbContext.Remove(recipe);

            await dbPocDbContext.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }