Ejemplo n.º 1
0
        public async Task <Genre> Delete(int id)
        {
            var entity = await _dbContext.FindAsync <Genre>(id);

            entity.IsDisabled = true;

            return(await Update(entity));
        }
        public async Task Delete(int id)
        {
            var item = await _context.FindAsync <T>(id);

            if (item == null)
            {
                return;
            }

            _context.Remove(item);
            await _context.SaveChangesAsync();
        }
Ejemplo n.º 3
0
        public async Task <bool> Handle(DeleteEntityByIdCommand <T> request, CancellationToken cancellationToken)
        {
            var entityToDelete = await _context.FindAsync <T>(request.Id);

            entityToDelete.IsDeleted = true;
            if (await _context.SaveChangesAsync() >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public async Task <T> Handle(Queries.GetEntityByIdBaseQuery <T> request, CancellationToken cancellationToken)
        {
            var result = await _context.FindAsync <T>(request.Id);

            return(result);
        }