public void Edit(Inventory inventory) { Inventory inventoryToChange = _context.Inventories.Find(inventory.InventoryId); inventoryToChange.Qty = inventory.Qty; inventoryToChange.Description = inventory.Description ?? inventoryToChange.Description; //inventoryToChange.ProductId = inventory.ProductId ?? inventoryToChange.ProductId; //inventoryToChange.Product = inventory.Product ?? inventoryToChange.Product; _context.SaveChanges(); }
public int CreateShoppingCart() { ShoppingCart shoppingCart = new ShoppingCart() { Created = DateTimeOffset.Now, }; _context.ShoppingCarts.Add(shoppingCart); _context.SaveChanges(); return(shoppingCart.ShoppingCartId); }
public void Add(Inventory inventory) { if (!IsProductAndSupplierExisted(inventory)) { Context.Inventories.Add(inventory); } else { Inventory currentInventory = GetInventoryByProductIdAndSupplierId((int)inventory.ProductId, (int)inventory.SupplierId); if (currentInventory != null) { currentInventory.Count += inventory.Count; } } Context.SaveChanges(); }
public void Add(Product product) { Context.Products.Add(product); Context.SaveChanges(); }
public void Add(Supplier supplier) { Context.Suppliers.Add(supplier); Context.SaveChanges(); }
public void Add(Order order) { Context.Orders.Add(order); Context.SaveChanges(); }
public void Add(Department department) { Context.Departments.Add(department); Context.SaveChanges(); }
//public List<OrderDetail> GetOrderDetailsListByName(string name) //{ // var orderDetailss = _context.OrderDetails.Where(x => x.Name.Contains(name)).ToList(); // return orderDetailss; //} //public bool IsNameExisted(string name) //{ // bool isNameExisted = false; // isNameExisted = (_context.OrderDetails.Count(x => x.Name == name) > 0); // return isNameExisted; //} public void Add(OrderDetail orderDetails) { Context.OrderDetails.Add(orderDetails); Context.SaveChanges(); }
public void Add(OrderHistory orderHistory) { Context.OrderHistories.Add(orderHistory); Context.SaveChanges(); }
public void Add(Company company) { Context.Companies.Add(company); Context.SaveChanges(); }
public void Add(Position position) { Context.Positions.Add(position); Context.SaveChanges(); }
public void Add(Category category) { Context.Categories.Add(category); Context.SaveChanges(); }
public int Add(StockIn stockIn) { Context.StockIns.Add(stockIn); Context.SaveChanges(); return(stockIn.StockInId); }
public void Add(OrderDetailHistory orderDetailHistories) { Context.OrderDetailHistories.Add(orderDetailHistories); Context.SaveChanges(); }
public int Add(Order order) { Context.Orders.Add(order); Context.SaveChanges(); return(order.OrderId); }
public void Add(Group group) { Context.Groups.Add(group); Context.SaveChanges(); }
public void Add(UserGroup userGroup) { Context.UserGroups.Add(userGroup); Context.SaveChanges(); }
public void Add(ProductHistory productHistory) { Context.ProductHistories.Add(productHistory); Context.SaveChanges(); }
public void Add(ShoppingCart shoppingCart) { Context.ShoppingCarts.Add(shoppingCart); Context.SaveChanges(); }
public void Add(Employee employee) { Context.Employees.Add(employee); Context.SaveChanges(); }
public void Add(ProductType productType) { Context.ProductTypes.Add(productType); Context.SaveChanges(); }
public void Add(Permission permission) { Context.Permissions.Add(permission); Context.SaveChanges(); }
public void Add(User user) { Context.Users.Add(user); Context.SaveChanges(); }