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(); }
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); } }
public async Task <T> Handle(Queries.GetEntityByIdBaseQuery <T> request, CancellationToken cancellationToken) { var result = await _context.FindAsync <T>(request.Id); return(result); }