public void SaveChanges() { using (var container = new DomainModelContainer()) { var product1 = new Product { Name = "Item 1" }; var product2 = new Product { Name = "Item 2" }; var customer = new Customer { FirstName = "Elton", LastName = "Stoneman" }; var order = new Order { Reference = Guid.NewGuid().ToString(), Customer = customer }; order.Products.Add(product1); order.Products.Add(product2); container.Orders.Add(order); container.Save(); } }
public void UpdateProduct() { using (var container = new DomainModelContainer()) { var product = container.Products.First(); product.Name += " - new!"; container.Save(); } }
public void UpdateOrder() { using (var container = new DomainModelContainer()) { var order = container.Orders.First(); order.Reference += ".1"; container.Save(); } }
// POST api/customers public HttpResponseMessage Post([FromBody] Customer customer) { using (var container = new DomainModelContainer()) { container.Customers.Add(customer); container.Save(); } var response = new HttpResponseMessage(HttpStatusCode.Created); return(response); }