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; }
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); }
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; }
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); }