Beispiel #1
0
        public async Task <CommandResult <TEntity> > Handle(DeleteEntityCommand <TEntity> request, CancellationToken cancellationToken)
        {
            int nb = await baseService.DeleteAsync(request.Entity);

            if (nb > 0)
            {
                return(new CommandResult <TEntity>()
                {
                    Entity = request.Entity, Message = $"{nb} {(nb == 1 ? "entity" : "entities")} deleted.", Result = CommandState.Success
                });
            }
            else
            {
                return(new CommandResult <TEntity>()
                {
                    Entity = request.Entity, Message = "no entity deleted.", Result = CommandState.Warning
                });
            }
        }
        public async Task <CommandResult> Handle(DeleteEntityCommand <TEntity> request, CancellationToken cancellationToken)
        {
            CommandResult result = await baseService.DeleteAsync(request.Entity);

            return(result);
        }