public void AddStore() { try { Store toAdd = new Store(2, "apply", itamar); storeDB.Add(toAdd); li = storeDB.Get(); Assert.AreEqual(li.Count, 2); } catch (Exception e) { Assert.AreEqual(true, false, "there was a connection error to the testing db"); } }
public void init() { WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB(); cDB.emptyDB(); configuration.DB_MODE = testing; storeDB = new StoreDB(testing); li = new LinkedList <Store>(); itamar = new User("itamar", "123"); storeDB.Add(new Store(1, "halavi", itamar)); }
public Store addStore(String storeName, User storeOwner) { Store newStore; lock (this) { newStore = new Store(getNextStoreId(), storeName, storeOwner); } foreach (Store s in stores) { if (s.getStoreId() == newStore.getStoreId()) { return(null); } } SDB.Add(newStore); stores.AddLast(newStore); return(newStore); }
public async Task <IActionResult> Create([Bind("Id,Name,Price,Qty,Status")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Date,CreditLimit")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }