Exemple #1
0
 //Create
 public Order Insert(Order order)
 {
     using (Entities ctx = new Entities())
     {
         ctx.Order.Add(order);
         ctx.SaveChanges();
         return order;
     }
 }
Exemple #2
0
 //Create
 public CPA Insert()
 {
     using (Entities ctx = new Entities())
     {
         ctx.CPA.Add(this);
         ctx.SaveChanges();
         return this;
     }
 }
Exemple #3
0
 //Create
 public AppUser Insert()
 {
     using (Entities ctx = new Entities())
     {
         ctx.AppUser.Add(this);
         ctx.SaveChanges();
         return this;
     }
 }
Exemple #4
0
 //Create
 public Item Insert()
 {
     using (Entities ctx = new Entities())
     {
         ctx.Item.Add(this);
         ctx.SaveChanges();
         return this;
     }
 }
Exemple #5
0
 //Update
 public CPA Update()
 {
     using (Entities ctx = new Entities())
     {
         CPA CPA = ctx.CPA.First(x => x.CPAID == this.CPAID);
         CPA = this;
         ctx.SaveChanges();
         return CPA;
     }
 }
Exemple #6
0
 //Update
 public Order Update()
 {
     using (Entities ctx = new Entities())
     {
         Order Order = ctx.Order.First(x => x.OrderID == this.OrderID);
         Order = this;
         ctx.SaveChanges();
         return Order;
     }
 }
Exemple #7
0
 //Update
 public Item Update()
 {
     using (Entities ctx = new Entities())
     {
         Item Item = ctx.Item.First(x => x.ItemID == this.ItemID);
         Item = this;
         ctx.SaveChanges();
         return Item;
     }
 }
Exemple #8
0
 //Update
 public AppUser Update()
 {
     using (Entities ctx = new Entities())
     {
         AppUser AppUser = ctx.AppUser.First(x => x.AppUserID == this.AppUserID);
         AppUser = this;
         ctx.SaveChanges();
         return AppUser;
     }
 }
 //Update
 public CPAStage Update()
 {
     using (Entities ctx = new Entities())
     {
         CPAStage CPAStage = ctx.CPAStage.First(x => x.CPAStageID == this.CPAStageID);
         CPAStage = this;
         ctx.SaveChanges();
         return CPAStage;
     }
 }
Exemple #10
0
 //Update
 public CartItem Update()
 {
     using (Entities ctx = new Entities())
     {
         CartItem CartItem = ctx.CartItem.First(x => x.CartItemID == this.CartItemID);
         CartItem = this;
         ctx.SaveChanges();
         return CartItem;
     }
 }
Exemple #11
0
 //Update
 public Category Update()
 {
     using (Entities ctx = new Entities())
     {
         Category Category = ctx.Category.First(x => x.CategoryID == this.CategoryID);
         Category = this;
         ctx.SaveChanges();
         return Category;
     }
 }
Exemple #12
0
 //Create
 public CartItem Insert(CartItem CartItem)
 {
     using (Entities ctx = new Entities())
     {
         try
         {
             ctx.CartItem.Add(CartItem);
             ctx.SaveChanges();
             return this;
         }
         catch (Exception exception)
         {
             return this;
         }
     }
 }
Exemple #13
0
 //Delete By ID
 public Boolean Delete()
 {
     using(Entities ctx= new Entities())
     {
         try
         {
             CPA CPA = ctx.CPA.First(x => x.CPAID == this.CPAID);
             ctx.CPA.Remove(CPA);
             ctx.SaveChanges();
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
Exemple #14
0
 //Delete By ID
 public Boolean Delete()
 {
     using(Entities ctx= new Entities())
     {
         try
         {
             Order Order = ctx.Order.First(x => x.OrderID == this.OrderID);
             ctx.Order.Remove(Order);
             ctx.SaveChanges();
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
Exemple #15
0
 //Delete By ID
 public Boolean Delete()
 {
     using(Entities ctx= new Entities())
     {
         try
         {
             Item Item = ctx.Item.First(x => x.ItemID == this.ItemID);
             ctx.Item.Remove(Item);
             ctx.SaveChanges();
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
Exemple #16
0
 //Delete By ID
 public Boolean Delete()
 {
     using(Entities ctx= new Entities())
     {
         try
         {
             Category Category = ctx.Category.First(x => x.CategoryID == this.CategoryID);
             ctx.Category.Remove(Category);
             ctx.SaveChanges();
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }