public void GetAllProducts() { if (Convert.ToInt32(Session["UserId"]) == 0) { EmptyCart.Visible = true; CartItems.Visible = false; } else { EmptyCart.Visible = false; CartItems.Visible = true; List <CartItems_Result> objList = new List <CartItems_Result>(); using (var entities = new ShoppingCartEntities()) { objList = entities.CartItems(Convert.ToInt32(Session["UserId"])).ToList <CartItems_Result>(); } if (objList.Count != 0) { EmptyCart.Visible = false; CartItems.Visible = true; Repeater1.DataSource = objList; Repeater1.DataBind(); } else { EmptyCart.Visible = true; } CartItems.Visible = false; } }
public void GetAllCartItems() { List <CartItems_Result> objList = new List <CartItems_Result>(); using (var entities = new ShoppingCartEntities()) { objList = entities.CartItems(Convert.ToInt32(Session["UserId"])).ToList <CartItems_Result>(); } Repeater1.DataSource = objList; Repeater1.DataBind(); }