コード例 #1
0
ファイル: OrderRepo.cs プロジェクト: htphongqn/B2C_EC
 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
ファイル: OrderHistoryRepo.cs プロジェクト: htphongqn/B2C_EC
 public int CreateOrderHistory(OrderHistory A)
 {
     try
     {
         db.OrderHistories.Add(A);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #5
0
ファイル: ProductTypeRepo.cs プロジェクト: htphongqn/B2C_EC
 public int CreateProductType(ProductType U)
 {
     try
     {
         this.db.ProductTypes.Add(U);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #6
0
ファイル: AddressRepo.cs プロジェクト: htphongqn/B2C_EC
 public int CreateAddress(Address A)
 {
     try
     {
         db.Addresses.Add(A);
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #7
0
ファイル: UserRepo.cs プロジェクト: htphongqn/B2C_EC
 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
ファイル: ProductImageRepo.cs プロジェクト: htphongqn/B2C_EC
 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
ファイル: HelperRepo.cs プロジェクト: htphongqn/B2C_EC
 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
ファイル: OrderRepo.cs プロジェクト: htphongqn/B2C_EC
 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
ファイル: OrderRepo.cs プロジェクト: htphongqn/B2C_EC
 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);
     }
 }