public async Task <TEntity> CreateAsync(TEntity entity) { var result = (await DbSet.AddAsync(entity)).Entity; await ElasticRepository.UpdateSearchIndex(result, CrudAction.Create); return(result); }
public async Task <TEntity> Update(TEntity entity) { var result = DbSet.Update(entity).Entity; await ElasticRepository.UpdateSearchIndex(result, CrudAction.Update); return(result); }
public async Task <bool> UpdateBool(TEntity entity) { var entityDb = entity as Entity; if (entityDb != null) { var existingEntity = DbSet.Find(entityDb.Id); if (existingEntity == null) { return(false); } context.Entry(existingEntity).State = EntityState.Detached; await ElasticRepository.UpdateSearchIndex(existingEntity, CrudAction.Update); } context.Entry(entity).State = EntityState.Modified; return(true); }