public Page GetPage(string page) { using (ShoppingStoreContext Context = new ShoppingStoreContext()) { return(Context.Page.Where(x => x.Description == page).FirstOrDefault()); } }
public List <Page> GetAllPage() { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { return(shoppingStoreContext.Page.ToArray().OrderBy(x => x.Sorting).Where(x => x.Title != "homePages").ToList()); } }
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)); } }
public List <Category> SelectListItem() { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { return(shoppingStoreContext.Catagories.ToList()); } }
public List <Category> Category() { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { return(shoppingStoreContext.Catagories.ToArray().OrderBy(x => x.Sorting).Select(x => new Category(x)).ToList()); } }
public User PlaceOrder(string userName) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { return(shoppingStoreContext.Users.FirstOrDefault(x => x.UserName == userName)); } }
public Product GetProduct(string name) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { Product product = shoppingStoreContext.Products.Where(x => x.Slug == name).FirstOrDefault(); return(product); } }
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(); } }
public string GetCategoryName(int categoryId) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { Product product = shoppingStoreContext.Products.Where(x => x.CatagoryId == categoryId).FirstOrDefault(); return(product.CatagoryName); } }
public int GetCategoryId(string name) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { Category category = shoppingStoreContext.Catagories.Where(x => x.Description == name).FirstOrDefault(); return(category.Id); } }
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(); } }
public void SaveOrderDetails(OrderDetails order) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { shoppingStoreContext.OrderDetails.Add(order); shoppingStoreContext.SaveChanges(); } }
public void SavePlaceOrder(Order order) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { shoppingStoreContext.Orders.Add(order); shoppingStoreContext.SaveChanges(); } }
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(); } }
public void DeleteCatagory(int id) { using (ShoppingStoreContext shoppingStoreContext = new ShoppingStoreContext()) { Category category = shoppingStoreContext.Catagories.Find(id); shoppingStoreContext.Catagories.Remove(category); shoppingStoreContext.SaveChanges(); } }
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); } }
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()); } }
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"); } }
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); } }
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); }
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); } }