Пример #1
0
 public int CreateOrder(Order C)
 {
     try
     {
         this.db.Orders.Add(C);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #2
0
 public int CreateProduct(Product P)
 {
     try
     {
         db.Products.Add(P);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #3
0
 public int CreateCreditCardType(CreditCardType A)
 {
     try
     {
         db.CreditCardTypes.Add(A);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #4
0
 public int CreateOrderHistory(OrderHistory A)
 {
     try
     {
         db.OrderHistories.Add(A);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #5
0
 public int CreateProductType(ProductType U)
 {
     try
     {
         this.db.ProductTypes.Add(U);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #6
0
 public int CreateAddress(Address A)
 {
     try
     {
         db.Addresses.Add(A);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #7
0
 public int CreateUser(User U)
 {
     try
     {
         this.db.Users.Add(U);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #8
0
 public int CreateContact(Contact C)
 {
     try
     {
         this.db.Contacts.Add(C);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #9
0
 public int DeleteProductImage(int Id)
 {
     try
     {
         ProductImage pi = db.ProductImages.Where(p => p.ID == Id).FirstOrDefault();
         db.ProductImages.Remove(pi);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #10
0
 public virtual int Create(T obj)
 {
     try
     {
         if (ValidateCreate(obj))
         {
             this.DbSet.Add(obj);
             return(db.SaveChanges());
         }
         return(0);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #11
0
 public int CreateReview(Review R)
 {
     try
     {
         this.db.Reviews.Add(R);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #12
0
 public int UpdateStatus(int orderID, int statusID)
 {
     try
     {
         using (var context = new B2C_ECEntities())
         {
             context.Orders.Find(orderID).OrderStatus_ID = statusID;
             return(context.SaveChanges());
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #13
0
 public int UpdateStatus(int orderID, int statusID)
 {
     try
     {
         using (var context = new B2C_ECEntities())
         {
             context.Orders.Find(orderID).OrderStatus_ID = statusID;
             return context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }