public virtual int Create(TEntity newEntity) { var dbEntity = GetEntity(newEntity); dbEntity.State = EntityState.Added; Db.SaveChanges(); return(newEntity.Id); }
public virtual int Create(TEntity newEntity) { var dbEntity = GetEntity(newEntity); dbEntity.State = EntityState.Added; Db.SaveChanges(); var id = newEntity.Id; Cache?.Add($"{SingleCacheKeyPrefix}:{id}", JsonConvert.SerializeObject(newEntity)); return(id); }