예제 #1
0
        public bool AddItemShoppingCart(ItemDetailsModel item)
        {
            Repository.ShoppingDbEntities db = new Repository.ShoppingDbEntities();
            var newItem = db.ItemDetails.Create();
            newItem.Image_Name = item.Image_Name;
            newItem.Item_Id = item.Item_Id;
            newItem.Item_Name = item.Item_Name;
            newItem.Item_Price = item.Item_Price;

            db.ItemDetails.Add(newItem);
            db.SaveChanges();

            return true;
        }
예제 #2
0
        public bool AddItemShoppingCart(ItemDetailsModel item)
        {
            Repository.ShoppingDbEntities db = new Repository.ShoppingDbEntities();
            var newItem = db.ItemDetails.Create();

            newItem.Image_Name = item.Image_Name;
            newItem.Item_Id    = item.Item_Id;
            newItem.Item_Name  = item.Item_Name;
            newItem.Item_Price = item.Item_Price;

            db.ItemDetails.Add(newItem);
            db.SaveChanges();

            return(true);
        }
예제 #3
0
        public IEnumerable<ItemDetailsModel> GetItemDetails()
        {
            Repository.ShoppingDbEntities db = new Repository.ShoppingDbEntities();
            var query = db.ItemDetails;

            IList<ItemDetailsModel> itemsList = new List<ItemDetailsModel>();
            query.ToList().ForEach(item =>
            {
                itemsList.Add(new ItemDetailsModel()
                {
                    Item_Id = item.Item_Id,
                    Item_Name = item.Item_Name,
                    Item_Price = item.Item_Price ?? 0,
                    Image_Name = item.Image_Name
                });
            });

            return itemsList;
        }
예제 #4
0
        public IEnumerable <ItemDetailsModel> GetItemDetails()
        {
            Repository.ShoppingDbEntities db = new Repository.ShoppingDbEntities();
            var query = db.ItemDetails;

            IList <ItemDetailsModel> itemsList = new List <ItemDetailsModel>();

            query.ToList().ForEach(item =>
            {
                itemsList.Add(new ItemDetailsModel()
                {
                    Item_Id    = item.Item_Id,
                    Item_Name  = item.Item_Name,
                    Item_Price = item.Item_Price ?? 0,
                    Image_Name = item.Image_Name
                });
            });

            return(itemsList);
        }