Ejemplo n.º 1
0
        public async Task HandleAsync(DeleteCommand <T> command)
        {
            var entity = await this.repository.Set <T>().SingleOrDefaultAsync(e => e.Id == command.Id);

            if (entity != null)
            {
                this.repository.Set <T>().Remove(entity);
                await this.repository.SaveChangesAsync();
            }
        }
Ejemplo n.º 2
0
        public void Handle(DeleteCommand <T> command)
        {
            var entity = this.repository.Set <T>().SingleOrDefault(e => e.Id == command.Id);

            if (entity != null)
            {
                this.repository.Set <T>().Remove(entity);
                this.repository.SaveChanges();
            }
        }