public Page GetPage(string page)
 {
     using (ShoppingStoreContext Context = new ShoppingStoreContext())
     {
         return(Context.Page.Where(x => x.Description == page).FirstOrDefault());
     }
 }
Example #2
0
 public List <Page> GetAllPage()
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         return(shoppingStoreContext.Page.ToArray().OrderBy(x => x.Sorting).Where(x => x.Title != "homePages").ToList());
     }
 }
Example #3
0
 public Product EditProduct(int id)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         return(shoppingStoreContext.Products.Find(id));
     }
 }
 public SideBar SideBar()
 {
     using (ShoppingStoreContext Context = new ShoppingStoreContext())
     {
         return(Context.Bars.Find(1));
     }
 }
Example #5
0
 public List <Category> SelectListItem()
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         return(shoppingStoreContext.Catagories.ToList());
     }
 }
Example #6
0
 public List <Category> Category()
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         return(shoppingStoreContext.Catagories.ToArray().OrderBy(x => x.Sorting).Select(x => new Category(x)).ToList());
     }
 }
Example #7
0
 public User PlaceOrder(string userName)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         return(shoppingStoreContext.Users.FirstOrDefault(x => x.UserName == userName));
     }
 }
Example #8
0
 public Product GetProduct(string name)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Product product = shoppingStoreContext.Products.Where(x => x.Slug == name).FirstOrDefault();
         return(product);
     }
 }
Example #9
0
 public List <Product> ListOfProducts(int categoryId)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         List <Product> products = shoppingStoreContext.Products.ToArray().Where(x => x.CatagoryId == categoryId).Select(x => new Product(x)).ToList();
         return(products);
     }
 }
 public void AddPage(Page data)
 {
     using (ShoppingStoreContext Context = new ShoppingStoreContext())
     {
         Context.Page.Add(data);
         Context.SaveChanges();
     }
 }
Example #11
0
 public string GetCategoryName(int categoryId)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Product product = shoppingStoreContext.Products.Where(x => x.CatagoryId == categoryId).FirstOrDefault();
         return(product.CatagoryName);
     }
 }
Example #12
0
 public int GetCategoryId(string name)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Category category = shoppingStoreContext.Catagories.Where(x => x.Description == name).FirstOrDefault();
         return(category.Id);
     }
 }
Example #13
0
 public Product AddToCart(int id)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         // Get the product
         return(shoppingStoreContext.Products.Find(id));
     }
 }
 public Page EditPage(int id)
 {
     using (ShoppingStoreContext Context = new ShoppingStoreContext())
     {
         Page page = Context.Page.Find(id);
         return(page);
     }
 }
 public List <Page> ListOfPage()
 {
     using (ShoppingStoreContext Context = new ShoppingStoreContext())
     {
         List <Page> page = Context.Page.ToArray().OrderBy(sort => sort.Sorting).Select(sorted => new Page(sorted)).ToList();
         return(page);
     }
 }
 public void EditViewBar(SideBar sideBar)
 {
     using (ShoppingStoreContext Context = new ShoppingStoreContext())
     {
         sideBar      = Context.Bars.Find(1);
         sideBar.Body = sideBar.Body;
         Context.SaveChanges();
     }
 }
Example #17
0
        public void SaveOrderDetails(OrderDetails order)
        {
            using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
            {
                shoppingStoreContext.OrderDetails.Add(order);

                shoppingStoreContext.SaveChanges();
            }
        }
Example #18
0
        public void SavePlaceOrder(Order order)
        {
            using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
            {
                shoppingStoreContext.Orders.Add(order);

                shoppingStoreContext.SaveChanges();
            }
        }
Example #19
0
 public void DeleteProduct(int id)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Product product = shoppingStoreContext.Products.Find(id);
         shoppingStoreContext.Products.Remove(product);
         shoppingStoreContext.SaveChanges();
     }
 }
        public void DeletePage(int id, Page page)
        {
            using (ShoppingStoreContext Context = new ShoppingStoreContext())
            {
                Context.Page.Remove(page);

                Context.SaveChanges();
            }
        }
Example #21
0
 public void DeleteCatagory(int id)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Category category = shoppingStoreContext.Catagories.Find(id);
         shoppingStoreContext.Catagories.Remove(category);
         shoppingStoreContext.SaveChanges();
     }
 }
Example #22
0
 public Product FindProduct(int id)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Product product = shoppingStoreContext.Products.Find(id);
         shoppingStoreContext.SaveChanges();
         return(product);
     }
 }
        public User ShowUser(string userName)
        {
            using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
            {
                // Get the user
                User userValue = shoppingStoreContext.Users.FirstOrDefault(x => x.UserName == userName);

                return(userValue);
            }
        }
Example #24
0
 public List <Product> ListOfProduct(Product product, int?categoryId)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         return(shoppingStoreContext.Products.ToArray()
                .Where(x => categoryId == null || categoryId == 0 || x.CatagoryId == categoryId)
                .Select(x => new Product(x))
                .ToList());
     }
 }
Example #25
0
 public Product UploadImage(int id)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Product product = shoppingStoreContext.Products.Find(id);
         shoppingStoreContext.SaveChanges();
         return(product);
         // product.Categories = new SelectList(shoppingStoreContext.Catagories.ToList(), "Id", "Name");
     }
 }
Example #26
0
 public Category SaveProduct(Product product)
 {
     using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
     {
         Category category = shoppingStoreContext.Catagories.FirstOrDefault(x => x.Id == product.CatagoryId);
         shoppingStoreContext.Products.Add(product);
         shoppingStoreContext.SaveChanges();
         return(category);
     }
 }
Example #27
0
        public bool CheckPage(string page)
        {
            bool status = false;

            using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
            {
                if (shoppingStoreContext.Page.Any(x => x.Description.Equals(page)))
                {
                    status = true;
                }
                return(status);
            }
        }
        public bool Login(Login login)
        {
            bool isValid = false;

            using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
            {
                if (shoppingStoreContext.Users.Any(x => x.UserName.Equals(login.Username) && x.Password.Equals(login.Password)))
                {
                    isValid = true;
                }
            }
            return(isValid);
        }
Example #29
0
        public bool ProductDetails(string name)
        {
            bool status = false;

            using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext())
            {
                if (!shoppingStoreContext.Products.Any(x => x.Slug.Equals(name)))
                {
                    status = true;
                }
                return(status);
            }
        }
        public bool CheckPage(Page page)
        {
            bool status = false;

            using (ShoppingStoreContext Context = new ShoppingStoreContext())
            {
                if (Context.Page.Any(exists => exists.Title == page.Title) || (Context.Page.Any(exists => exists.Description == page.Description)))
                {
                    status = true;
                }
                return(status);
            }
        }