public Boolean setBookRfidListOnShelfRfid(String shelfRfid, List <String> bookRfidList) { if (bookRfidList.Count == 0 || String.IsNullOrEmpty(shelfRfid)) { return(false); } //delete the item in book on shelf foreach (String bookRfidCode in bookRfidList) { var findItemList = dbEntities.BookOnShelf.Where((item) => item.bookRfidCode == bookRfidCode); foreach (BookOnShelf item in findItemList) { dbEntities.BookOnShelf.Remove(item); } } //insert the item in book on shelf foreach (String bookRfidCode in bookRfidList) { BookOnShelf item = new BookOnShelf(); item.shelfRfidCode = shelfRfid; item.bookRfidCode = bookRfidCode; dbEntities.BookOnShelf.Add(item); } dbEntities.SaveChanges(); return(true); }
public static void InsertLocation() { using (var context = new LocationEntities()) { var park = new Park { Name = "11th Street Park", Address = "801 11th Street", City = "Aledo", State = "TX", ZIPCode = "76106" }; var loc = new Location { Address = "501 Main", City = "Weatherford", State = "TX", ZIPCode = "76201" }; park.Office = loc; context.Locations.Add(park); context.SaveChanges(); } }
//Save Records public void Save() { _db.SaveChanges(); }
public CLIENT CreateClient(CLIENT client) { context.CLIENT.Add(client); context.SaveChanges(); return(client); }
public LOUE CreateLocation(LOUE location) { context.LOUE.Add(location); context.SaveChanges(); return(location); }