Ejemplo n.º 1
0
 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"); }
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }