示例#1
0
        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();
        }
示例#2
0
        public int CreateShoppingCart()
        {
            ShoppingCart shoppingCart = new ShoppingCart()
            {
                Created = DateTimeOffset.Now,
            };

            _context.ShoppingCarts.Add(shoppingCart);
            _context.SaveChanges();

            return(shoppingCart.ShoppingCartId);
        }
示例#3
0
 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();
 }
示例#4
0
 public void Add(Product product)
 {
     Context.Products.Add(product);
     Context.SaveChanges();
 }
示例#5
0
 public void Add(Supplier supplier)
 {
     Context.Suppliers.Add(supplier);
     Context.SaveChanges();
 }
示例#6
0
 public void Add(Order order)
 {
     Context.Orders.Add(order);
     Context.SaveChanges();
 }
示例#7
0
 public void Add(Department department)
 {
     Context.Departments.Add(department);
     Context.SaveChanges();
 }
示例#8
0
        //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();
        }
示例#9
0
 public void Add(OrderHistory orderHistory)
 {
     Context.OrderHistories.Add(orderHistory);
     Context.SaveChanges();
 }
示例#10
0
 public void Add(Company company)
 {
     Context.Companies.Add(company);
     Context.SaveChanges();
 }
示例#11
0
 public void Add(Position position)
 {
     Context.Positions.Add(position);
     Context.SaveChanges();
 }
示例#12
0
 public void Add(Category category)
 {
     Context.Categories.Add(category);
     Context.SaveChanges();
 }
示例#13
0
 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();
 }
示例#15
0
 public int Add(Order order)
 {
     Context.Orders.Add(order);
     Context.SaveChanges();
     return(order.OrderId);
 }
示例#16
0
 public void Add(Group group)
 {
     Context.Groups.Add(group);
     Context.SaveChanges();
 }
示例#17
0
 public void Add(UserGroup userGroup)
 {
     Context.UserGroups.Add(userGroup);
     Context.SaveChanges();
 }
示例#18
0
 public void Add(ProductHistory productHistory)
 {
     Context.ProductHistories.Add(productHistory);
     Context.SaveChanges();
 }
示例#19
0
 public void Add(ShoppingCart shoppingCart)
 {
     Context.ShoppingCarts.Add(shoppingCart);
     Context.SaveChanges();
 }
示例#20
0
 public void Add(Employee employee)
 {
     Context.Employees.Add(employee);
     Context.SaveChanges();
 }
示例#21
0
 public void Add(ProductType productType)
 {
     Context.ProductTypes.Add(productType);
     Context.SaveChanges();
 }
示例#22
0
 public void Add(Permission permission)
 {
     Context.Permissions.Add(permission);
     Context.SaveChanges();
 }
示例#23
0
 public void Add(User user)
 {
     Context.Users.Add(user);
     Context.SaveChanges();
 }