//Create public Order Insert(Order order) { using (Entities ctx = new Entities()) { ctx.Order.Add(order); ctx.SaveChanges(); return order; } }
//Create public CPA Insert() { using (Entities ctx = new Entities()) { ctx.CPA.Add(this); ctx.SaveChanges(); return this; } }
//Create public AppUser Insert() { using (Entities ctx = new Entities()) { ctx.AppUser.Add(this); ctx.SaveChanges(); return this; } }
//Create public Item Insert() { using (Entities ctx = new Entities()) { ctx.Item.Add(this); ctx.SaveChanges(); return this; } }
//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; } }
//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; } }
//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; } }
//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; } }
//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; } }
//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; } }
//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; } } }
//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; } } }
//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; } } }
//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; } } }
//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; } } }