public static void DeleteScCompInfoWithoutSelect() { var comp = new ScCompInfo { CompSn = 30 }; using (var db = new WebDbContext()) { //db.ScCompInfoes.Attach(comp); //db.ScCompInfoes.Remove(comp); db.Entry(comp).State = System.Data.Entity.EntityState.Deleted; try { db.SaveChanges(); } catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); } } }
public static async Task UpdateScCompInfoAsync() { using (var db = new WebDbContext()) { var compinfo = await db.ScCompInfoes.FindAsync(6); if (compinfo != null) { compinfo.CompNm = "업데이트111"; } else { var comp = new ScCompInfo { Addr1 = "테스트업데이트주소", CompNm = "업데이트당ㅇ앙아앙아", CompType = "A" }; db.ScCompInfoes.Add(comp); } await db.SaveChangesAsync(); } }
public async Task <int> AddMentorAsync(ScCompInfo scCompInfo) { //var rstScUsr = scUsrRespository.Insert(scUsr); //scCompInfo. var rstScCompInfo = scCompInfoRespository.Insert(scCompInfo); if (rstScCompInfo == null) { return(-1); } return(await SaveDbContextAsync()); }
public static void UpdateScCompInfoWithoutSelect() { var comp = new ScCompInfo { CompSn = 85 }; using (var db = new WebDbContext()) { db.ScCompInfoes.Attach(comp); comp.CompNm = "bizon188"; db.SaveChanges(); } }
public static async void insertScCompInfoAsync() { var comp = new ScCompInfo { Addr1 = "테스트주소", CompNm = "테스트회사", CompType = "A" }; using (var db = new WebDbContext()) { db.ScCompInfoes.Add(comp); //이것도 가능 //db.Entry<ScCompInfo>(comp).State = System.Data.Entity.EntityState.Added; await db.SaveChangesAsync(); } }
public async Task <int> AddCompanyUserAsync(ScCompInfo scCompInfo, ScUsr scUsr, SHUSER_SyUser syUser) { //var rstScUsr = scUsrRespository.Insert(scUsr); //scCompInfo. var rstScCompInfo = scCompInfoRespository.Insert(scCompInfo); var rstSyUser = syUserRespository.Insert(syUser); if (rstScCompInfo == null || rstSyUser != 1) { return(-1); } var rst = await SaveDbContextAsync(); return(rst); //if (rst != 1) // return rst; //return await SaveDareDbContextAsync(); }
public static void UpdateScCompInfo() { using (var db = new WebDbContext()) { var compinfo = db.ScCompInfoes.Find(6); if (compinfo != null) { compinfo.CompNm = "업데이트111"; } else { var comp = new ScCompInfo { Addr1 = "테스트업데이트주소", CompNm = "업데이트당ㅇ앙아앙아", CompType = "A" }; db.ScCompInfoes.Add(comp); } db.SaveChanges(); } }
public void CreateScCompInfo(ScCompInfo scCompInfo) { scCompInfoRespository.Add(scCompInfo); }