//Retrieve List public List<Category> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.Category.ToList<Category>(); } }
//Retrieve By ID public Category GetByID(long Id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.Category.First(x => x.CategoryID == Id)); } }
//Retrieve By ID public CartItem GetByID(long Id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.CartItem.First(x => x.CartItemID == Id); } }
//Retrieve List public List <CartItem> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.CartItem.ToList <CartItem>()); } }
//Retrieve By ID public AppUser GetByID(long Id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.AppUser.First(x => x.AppUserID == Id)); } }
//Retrieve By AppUserID public List <Order> GetByAppUserID(long AppUserId) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.Order.Where(x => x.AppUserID == AppUserId).ToList()); } }
//Retrieve List public List <AppUser> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.AppUser.ToList <AppUser>()); } }
//Retrieve By OrderID public List<CartItem> GetByOrderID(long orderId) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.CartItem.Include("Item").Where(x => x.OrderID == orderId).ToList(); } }
//Retrieve By AppUserID public List<Order> GetByAppUserID(long AppUserId) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.Order.Where(x => x.AppUserID == AppUserId).ToList(); } }
//Retrieve List public List<CartItem> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.CartItem.ToList<CartItem>(); } }
//Retreive by categoryId public List<Item> GetByCategoryId(long categoryId) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.Item.Where(x => x.CategoryID == categoryId).ToList(); } }
//Retreive by categoryId public List <Item> GetByCategoryId(long categoryId) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.Item.Where(x => x.CategoryID == categoryId).ToList()); } }
//Retrieve By ID public Order GetByID(long Id) { using(OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.Order.First(x=>x.OrderID == Id); } }
//Retrieve List public List<CPAStage> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.CPAStage.ToList<CPAStage>(); } }
//public AppUser Login(AppUser appuser) //Login public AppUser Login(string Username, string Password) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.AppUser.FirstOrDefault(x => x.Username == Username && x.Password == Password); } }
//Retrieve List public List <Category> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.Category.ToList <Category>()); } }
//Retrieve By ID public Category GetByID(long Id) { using(OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.Category.First(x=>x.CategoryID == Id); } }
//Retrieve By OrderID public List <CartItem> GetByOrderID(long orderId) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.CartItem.Include("Item").Where(x => x.OrderID == orderId).ToList()); } }
//Retrieve List public List<Order> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.Order.ToList<Order>(); } }
//Retrieve By ID public CartItem GetByID(long Id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.CartItem.First(x => x.CartItemID == Id)); } }
//Retrieve By ID public CPAStage GetByID(long Id) { using(OrderTrackEntities ctx = new OrderTrackEntities()) { return ctx.CPAStage.First(x=>x.CPAStageID == Id); } }
//Retrieve By ID public CPAStage GetByID(long Id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.CPAStage.First(x => x.CPAStageID == Id)); } }
//Retrieve List public List <CPAStage> GetList() { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.CPAStage.ToList <CPAStage>()); } }
//Login public AppUser Login(string Username, string Password) //public AppUser Login(AppUser appuser) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { return(ctx.AppUser.FirstOrDefault(x => x.Username == Username && x.Password == Password)); } }
//Create public Order Insert(Order order) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Order.Add(order); ctx.SaveChanges(); return(this); } }
//Create public CPA Insert(CPA cpa) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.CPA.Add(cpa); ctx.SaveChanges(); return(this); } }
//Create public CPA Insert(CPA cpa) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.CPA.Add(cpa); ctx.SaveChanges(); return this; } }
//Create public Item Insert(Item item) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Item.Add(item); ctx.SaveChanges(); return this; } }
//Create public AppUser Insert(AppUser appuser) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.AppUser.Add(appuser); ctx.SaveChanges(); return(this); } }
//Create public Order Insert(Order order) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Order.Add(order); ctx.SaveChanges(); return this; } }
//Create public Item Insert(Item item) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Item.Add(item); ctx.SaveChanges(); return(this); } }
//Create public CartItem Insert(CartItem cartitem) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.CartItem.Add(cartitem); ctx.SaveChanges(); return(this); } }
//Create public Category Insert(Category category) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Category.Add(category); ctx.SaveChanges(); return this; } }
//Create public CPAStage Insert(CPAStage cpastage) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.CPAStage.Add(cpastage); ctx.SaveChanges(); return(this); } }
//Create public Category Insert(Category category) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Category.Add(category); ctx.SaveChanges(); return(this); } }
//Create public CPAStage Insert(CPAStage cpastage) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.CPAStage.Add(cpastage); ctx.SaveChanges(); return this; } }
//Create public AppUser Insert(AppUser appuser) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.AppUser.Add(appuser); ctx.SaveChanges(); return this; } }
//Update public Category Update(Category category) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Category Category = ctx.Category.First(x => x.CategoryID == this.CategoryID); Category = category; ctx.SaveChanges(); return(Category); } }
//Update public Order Update(Order order) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Order Order = ctx.Order.First(x => x.OrderID == this.OrderID); Order = order; ctx.SaveChanges(); return(Order); } }
//Update public AppUser Update(AppUser appuser) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { AppUser AppUser = ctx.AppUser.First(x => x.AppUserID == this.AppUserID); AppUser = appuser; ctx.SaveChanges(); return AppUser; } }
//Update public CPA Update(CPA cpa) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { CPA CPA = ctx.CPA.First(x => x.CPAID == this.CPAID); CPA = cpa; ctx.SaveChanges(); return CPA; } }
//Update public CPAStage Update(CPAStage cpastage) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { CPAStage CPAStage = ctx.CPAStage.First(x => x.CPAStageID == this.CPAStageID); CPAStage = cpastage; ctx.SaveChanges(); return CPAStage; } }
//Update public CPA Update(CPA cpa) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { CPA CPA = ctx.CPA.First(x => x.CPAID == this.CPAID); CPA = cpa; ctx.SaveChanges(); return(CPA); } }
//Update public Item Update(Item item) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Item Item = ctx.Item.First(x => x.ItemID == this.ItemID); Item = item; ctx.SaveChanges(); return Item; } }
//Update public AppUser Update(AppUser appuser) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { AppUser AppUser = ctx.AppUser.First(x => x.AppUserID == this.AppUserID); AppUser = appuser; ctx.SaveChanges(); return(AppUser); } }
//Update public Item Update(Item item) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Item Item = ctx.Item.First(x => x.ItemID == this.ItemID); Item = item; ctx.SaveChanges(); return(Item); } }
//Update public Category Update(Category category) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Category Category = ctx.Category.First(x => x.CategoryID == this.CategoryID); Category = category; ctx.SaveChanges(); return Category; } }
//Update public CartItem Update(CartItem cartitem) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { CartItem CartItem = ctx.CartItem.First(x => x.CartItemID == this.CartItemID); CartItem = cartitem; ctx.SaveChanges(); return(CartItem); } }
//Update public Order Update(Order order) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Order Order = ctx.Order.First(x => x.OrderID == this.OrderID); Order = order; ctx.SaveChanges(); return Order; } }
//Update public CPAStage Update(CPAStage cpastage) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { CPAStage CPAStage = ctx.CPAStage.First(x => x.CPAStageID == this.CPAStageID); CPAStage = cpastage; ctx.SaveChanges(); return(CPAStage); } }
//Delete By ID public Boolean Delete(long id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { try { AppUser AppUser = ctx.AppUser.First(x => x.AppUserID == id); ctx.AppUser.Remove(AppUser); ctx.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
//Delete By ID public Boolean Delete(long id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { try { CartItem CartItem = ctx.CartItem.First(x => x.CartItemID == id); ctx.CartItem.Remove(CartItem); ctx.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
//Delete By ID public Boolean Delete(long id) { using(OrderTrackEntities ctx= new OrderTrackEntities()) { try { Order Order = ctx.Order.First(x => x.OrderID == id); ctx.Order.Remove(Order); ctx.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
//Delete By ID public Boolean Delete(long id) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { try { CPAStage CPAStage = ctx.CPAStage.First(x => x.CPAStageID == id); ctx.CPAStage.Remove(CPAStage); ctx.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
//Delete By ID public Boolean Delete(long id) { using(OrderTrackEntities ctx= new OrderTrackEntities()) { try { CPAStage CPAStage = ctx.CPAStage.First(x => x.CPAStageID == id); ctx.CPAStage.Remove(CPAStage); ctx.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
//Delete By ID public Boolean Delete(long id) { using(OrderTrackEntities ctx= new OrderTrackEntities()) { try { Category Category = ctx.Category.First(x => x.CategoryID == id); ctx.Category.Remove(Category); ctx.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
//checkout public Boolean Checkout(long OrderID) { try { using (OrderTrackEntities ctx = new OrderTrackEntities()) { var items = GetByOrderID(OrderID); foreach (var item in items) { item.IsOrdered = true; item.DateOrdered = DateTime.Now; CartItem cartItem = new CartItem().Update(item); } } return true; } catch (Exception) { return false; } }
//checkout public Boolean Checkout(long OrderID) { try { using (OrderTrackEntities ctx = new OrderTrackEntities()) { var items = GetByOrderID(OrderID); foreach (var item in items) { item.IsOrdered = true; item.DateOrdered = DateTime.Now; CartItem cartItem = new CartItem().Update(item); } } return(true); } catch (Exception) { return(false); } }
//Create public CartItem Insert(CartItem cartitem) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.CartItem.Add(cartitem); ctx.SaveChanges(); return this; } }
//Update public CartItem Update(CartItem cartitem) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { CartItem CartItem = ctx.CartItem.First(x => x.CartItemID == this.CartItemID); CartItem = cartitem; ctx.SaveChanges(); return CartItem; } }