public Model.ProductOrder AddProductOrder(Model.ProductOrder newProductOrder) { _context.ProductOrders.Add(_mapper.ParseProductOrder(newProductOrder)); _context.SaveChanges(); _context.ChangeTracker.Clear(); return(newProductOrder); }
public Model.InventoryLineItem AddInventoryLineItem(Model.InventoryLineItem newInventoryLineItem) { _context.InventoryLineItems.Add(_mapper.ParseInventoryLineItem(newInventoryLineItem)); _context.SaveChanges(); return(newInventoryLineItem); }
public Model.Order AddOrder(Model.Order newOrder) { _context.Orders.Add(_mapper.ParseOrder(newOrder)); _context.SaveChanges(); return(newOrder); }
public Customer AddCustomer(Customer newCustomer) { _context.Customers.Add(_mapper.ParseCustomer(newCustomer)); _context.SaveChanges(); return(newCustomer); }
private void Seed() { using (var context = new Entity.StoreDBContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.Customers.AddRange ( new Entity.Customer { Id = 1, CustomerName = "Joe", CustomerEmail = "*****@*****.**" }, new Entity.Customer { Id = 2, CustomerName = "Sally", CustomerEmail = "*****@*****.**" } ); context.Locations.AddRange ( new Entity.Location { Id = 1, LocationName = "Bats and Brews", LocationAddress = "55 Bat Dr." }, new Entity.Location { Id = 2, LocationName = "Goblin's and Ghouls", LocationAddress = "42 Universe St" } ); context.Products.AddRange ( new Entity.Product { Id = 1, ProductName = "Eye of Newt", ProductPrice = 1 }, new Entity.Product { Id = 2, ProductName = "Bat Wool", ProductPrice = 3 }, new Entity.Product { Id = 3, ProductName = "Mandrake", ProductPrice = 12 } ); context.Inventories.AddRange ( new Entity.Inventory { Id = 1, InventoryProduct = 1, InventoryLocation = 1, Quantity = 12 }, new Entity.Inventory { Id = 2, InventoryProduct = 2, InventoryLocation = 1, Quantity = 9 }, new Entity.Inventory { Id = 3, InventoryProduct = 3, InventoryLocation = 1, Quantity = 3 }, new Entity.Inventory { Id = 4, InventoryProduct = 1, InventoryLocation = 2, Quantity = 5 }, new Entity.Inventory { Id = 5, InventoryProduct = 2, InventoryLocation = 2, Quantity = 10 }, new Entity.Inventory { Id = 6, InventoryProduct = 3, InventoryLocation = 2, Quantity = 5 } ); context.SaveChanges(); } }
public Model.Product AddProduct(Model.Product newProduct) { _context.Products.Add(_mapper.ParseProduct(newProduct)); _context.SaveChanges(); return(newProduct); }
public Model.Location AddLocation(Model.Location newLocation) { _context.Locations.Add(_mapper.ParseLocation(newLocation)); _context.SaveChanges(); return(newLocation); }
private void Seed() { using (var context = new Entity.StoreDBContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.Customers.AddRange ( new Entity.Customer { CustId = 0, FirstName = "Jack", LastName = "Long", PhoneNumber = "123-444-5678" }, new Entity.Customer { CustId = 1, FirstName = "Tom", LastName = "Brady", PhoneNumber = "145-464-5690" } ); context.Locations.AddRange ( new Entity.Location { LocationId = 0, Address = "123 Way", State = "VA", LocationName = "Ski Store" }, new Entity.Location { LocationId = 1, Address = "42 Way", State = "VA", LocationName = "Ski Buy" } ); context.Products.AddRange ( new Entity.Product { ProductId = 0, ProductName = "Skis", Price = 22, Description = "They are skis" }, new Entity.Product { ProductId = 1, ProductName = "Boots", Price = 10, Description = "They are boots" } ); context.Items.AddRange ( new Entity.Item { ItemId = 0, Quantity = 20, ProductId = 1, LocationId = 1 }, new Entity.Item { ItemId = 1, Quantity = 10, ProductId = 0, LocationId = 0 } ); context.SaveChanges(); } }
public Model.CustomerCart AddCustomerCart(Model.CustomerCart newCustomerCart) { _context.CustomerCarts.Add(_mapper.ParseCustomerCart(newCustomerCart)); _context.SaveChanges(); return(newCustomerCart); }
public Model.Manager AddManager(Model.Manager newManager) { _context.Managers.Add(_mapper.ParseManager(newManager)); _context.SaveChanges(); return(newManager); }
public Model.CustomerOrderHistory AddCustomerOrderHistory(Model.CustomerOrderHistory newCustomerOrderHistory) { _context.CustomerOrderHistories.Add(_mapper.ParseCustomerOrderHistory(newCustomerOrderHistory)); _context.SaveChanges(); return(newCustomerOrderHistory); }
public Model.CustomerOrderLineItem AddCustomerOrderLineItem(Model.CustomerOrderLineItem newCustomerOrderLineItem) { _context.CustomerOrderLineItems.Add(_mapper.ParseCustomerOrderLineItem(newCustomerOrderLineItem)); _context.SaveChanges(); return(newCustomerOrderLineItem); }
public Model.Inventory AddInventory(Model.Inventory newInventory) { _context.Inventories.Add(_mapper.ParseInventory(newInventory)); _context.SaveChanges(); return(newInventory); }