public void Update(Parameter parameter) { Parameter param = db.Parameters.Single(p => p.Id == parameter.Id); param.SetParameter(parameter.Description, parameter.Value); db.SaveChanges(); }
public void SaveBeer(int amount) { _beerContext.Beers.Add(new Beer { AmountInMilliliters = amount, Timestamp = DateTime.UtcNow }); _beerContext.SaveChanges(); }
public void Edit() { var resultado = (from r in db.PurchaseOrders orderby r.Id descending select r).First(); var item = (from r in db.PurchaseOrderItems orderby r.Id descending select r).First(); item.SetPurchase(resultado.Id); db.SaveChanges(); }
public void SaveBeer_WithGivenAmout_SavesToContext() { // ARRANGE const int amount = 500; // ACT _beerBusiness.SaveBeer(amount); // ASSERT A.CallTo(() => _beerContext.Beers.Add(A <Beer> .That.Matches(b => b.AmountInMilliliters == amount && b.Timestamp != default(DateTime)))).MustHaveHappenedOnceExactly() .Then( A.CallTo(() => _beerContext.SaveChanges()).MustHaveHappenedOnceExactly()); }
public void Add(PurchaseOrder purchase) { db.PurchaseOrders.Add(purchase); db.SaveChanges(); new PurchaseOrderItemRepository().Edit(); }