public void SaveChapData(List <Chapter> chaps) { using (CrawelNovelDbContext context = new CrawelNovelDbContext()) { context.Chapter.AddRange(chaps); context.SaveChanges(); } }
public void UpdateCatalog(Catalog cata) { using (CrawelNovelDbContext context = new CrawelNovelDbContext()) { context.Catalog.Attach(cata); context.Entry(cata).Property("UpdateTime").IsModified = true; context.SaveChanges(); } }
public int SaveCatalog(Catalog cata) { int returnId = 0; using (CrawelNovelDbContext context = new CrawelNovelDbContext()) { context.Catalog.Add(cata); context.SaveChanges(); returnId = cata.Id; } return(returnId); }