protected IEnumerable<Product> GetCategoryProducts() { ShopEntities dbShop = new ShopEntities(); var shopP = dbShop.Product.Select(t => t); IEnumerable<Product> products = shopP; products = products.Where(t => t.CategoryId == categoryID); return (products); }
public void PutUser(User user) { _cache.Push(user.Email, user); ShopEntities db = new ShopEntities(); db.User.Add(user); }
protected void Save_Onclick(object sender, EventArgs e) { User h = new User(); h.First_Name = txtFirstName.Text; h.Last_Name = txtLastName.Text; h.Email = TextEmail.Text; h.Password = TextPassword.Text; ShopEntities dbShop = new ShopEntities(); dbShop.User.Add(h); dbShop.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { ShopEntities dbShop = new ShopEntities(); menuMen.DataSource = dbShop.Category.Where(t=>t.ParentID==1).ToList(); menuMen.DataBind(); menuWomen.DataSource = dbShop.Category.Where(t => t.ParentID == 2).ToList(); menuWomen.DataBind(); Bag.Text = "Bag " + "(" + _productManager.Summa().ToString() + "$" +")"; Refresh(); }
public User GetUser(string email) { var user = _cache.Get(email); if (user == null) { var dbShop = new ShopEntities(); user = dbShop.User.First(u=>u.Email == email); _cache.Push(user.Email, user); } return user; }
protected void Page_Load(object sender, EventArgs e) { var dbShop = new ShopEntities(); var temp = dbShop.Category.ToList(); var shop = dbShop.Category.Select(p => p); foreach (var c in shop) { string url = string.Format(NavigateUrl, c.id); var menuItem = new MenuItem(c.Name, c.id.ToString(), "", url); menuBar.Items.Add(menuItem); } }
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { int counter = 0; ShopEntities dbShop = new ShopEntities(); var shopU = dbShop.User.Select(t => t); foreach (var user in shopU) { if (user.Email == TextEmail.Text) { counter = counter + 1; } } args.IsValid = counter == 0; }
protected void Page_Load(object sender, EventArgs e) { ShopEntities dbShop = new ShopEntities(); var shopProduct = dbShop.Product.Select(t => t); IEnumerable<Product> products = shopProduct; if (HttpContext.Current.Request.QueryString.AllKeys.Contains("productID")) { int productId = int.Parse(HttpContext.Current.Request.QueryString["productID"]); products = products.Where(t => t.id == productId); Product first = products.First(); imageBigPicture.ImageUrl ="Images/Products/Big/"+first.Picture; labelProdectName.Text = first.Name; labelDescription.Text = first.Price.ToString(); labelDescription1.Text = first.Description; HttpContext.Current.Session.Add("productID", first.id.ToString()); _rvManager.AddProduct(productId); } }