public void CreateMetaBo(string userName) { userName = "******" + userName; MetaBoRepo borepo = new MetaBoRepo(); VersionsRepo vrepo = new VersionsRepo(); META_BO mbo = new META_BO { BO_NAME = BoName, BO_DB_NAME = BoName, TYPE = "form" }; mbo = borepo.Create(mbo, userName); db.META_BO.Add(mbo); VERSIONS version = vrepo.Create(mbo.META_BO_ID, userName); db.VERSIONS.Add(version); // db.SaveChanges(); foreach (var f in Fields) { db.META_FIELD.Add(new MetaFieldRepo().Create(f.MetaField(mbo.META_BO_ID, userName), userName)); } db.SaveChanges(); Task.Run(async() => await vrepo.CommitAsync(version.VERSIONS_ID, userName)); }
public async Task <META_BO> CreateAndSaveAsync(META_BO mETA_BO, string userName) { mETA_BO = Create(mETA_BO, userName); db.META_BO.Add(mETA_BO); VERSIONS version = new VersionsRepo().Create(mETA_BO.META_BO_ID, userName); db.VERSIONS.Add(version); await db.SaveChangesAsync(); return(mETA_BO); }