public Product AddProduct(Product product)
        {
            if (product.Category != null && product.CategoryId == 0)
            {
                context.Categories.Add(product.Category);
            }

            context.Products.Add(product);
            context.SaveChanges();
            return(product);
        }
示例#2
0
 public Promotion AddPromotion(Promotion promotion)
 {
     context.Promotions.Add(promotion);
     context.SaveChanges();
     return(promotion);
 }
示例#3
0
 public OrderDetail AddOrderDetail(OrderDetail orderDetail)
 {
     context.OrderDetails.Add(orderDetail);
     context.SaveChanges();
     return(orderDetail);
 }
示例#4
0
 public Order AddOrder(Order order)
 {
     context.Orders.Add(order);
     context.SaveChanges();
     return(order);
 }
 public Category AddCategory(Category Category)
 {
     context.Categories.Add(Category);
     context.SaveChanges();
     return(Category);
 }