public void DBStoreTest_Update() { DBStore db = new DBStore(); var store = db.Get(2); var addressOld = store.Address; var addressNew = "New Address 1"; var districtIdOld = store.District.Id; var districtIdNew = 3; store.Address = addressNew; store.District.Id = districtIdNew; db.Update(store); store = null; store = db.Get(2); Assert.AreEqual(addressNew, store.Address); Assert.AreEqual(districtIdNew, store.District.Id); //cleanup store.Address = addressOld; store.District.Id = districtIdOld; db.Update(store); }
// PUT api/<controller>/5 public Store Put(int id, [FromBody] Store value) { if (value != null) { var faulted = new Store() { IsFaulted = false }; try { value.Id = id; db.Update(value); return(faulted); } catch (DatabaseLink.DataLayerArgumentException e) { faulted.IsFaulted = true; faulted.DataLayerArgumentException = e.Message; } catch (DatabaseLink.DataLayerException e) { faulted.IsFaulted = true; faulted.DataLayerException = e.Message; } return(faulted); } return(null); }
public void DBStoreTest_Update_fail_District() { DBStore db = new DBStore(); Store store = new Store() { Id = 2 }; db.Update(store); }
public void DBStoreTest_Update_fail_ID() { DBStore db = new DBStore(); Store store = new Store() { Id = -1 }; db.Update(store); }
public void UpdateIllegalNegativeTest() { DBStore dB = new DBStore(this.dBConnect); var sp = new Store() { ID = -4 }; dB.Update(sp); }
public void UpdateGetEntityTest() { DBStore dB = new DBStore(this.dBConnect); var sp = dB.Get(1); Assert.IsNotNull(sp, "Store not retrieved"); var oldName = sp.Name; sp.Name = "Testttt"; dB.Update(sp); Assert.IsTrue(dB.Get(sp.ID).Name != oldName, "Name not changed"); sp.Name = oldName; dB.Update(sp); Assert.IsTrue(dB.Get(sp.ID).Name == oldName, "Name not reverted"); }
public IActionResult Put(int id, [FromBody] StoreDto dto) { try { provider.Update(dto.toDao()); return(Ok("Store updated successfully!")); } catch (Exception e) { return(BadRequest($"ERROR: {e.Message}")); } }
private bool Update() { return(DBStore.Update( this.guid, this.name, this.description, this.ownerName, this.ownerEmail, this.salesEmail, this.supportEmail, this.emailFrom, this.orderBCCEmail, this.phone, this.fax, this.address, this.city, this.zoneGuid, this.postalCode, this.countryGuid, this.isClosed, this.closedMessage)); }