Пример #1
0
        public ActionResult AddWishlistItem(AddWishlistItem model)
        {
            State.Instance.Wishlists[new User("James")].Add(new WishedItem
            {
                Name         = model.Name,
                Link         = model.Link,
                Price        = model.Price,
                Contributors = new Dictionary <User, decimal>()
            });

            return(RedirectToAction("Wishlist"));
        }
Пример #2
0
        public ActionResult AddWishlistItem(AddWishlistItem model)
        {
            State.Instance.Wishlists[new User("James")].Add(new WishedItem
            {
                Name = model.Name,
                Link = model.Link,
                Price = model.Price,
                Contributors = new Dictionary<User, decimal>()
            });

            return RedirectToAction("Wishlist");
        }
Пример #3
0
        public bool AddNewItem(AddWishlistItem item)
        {
            int listId = GetWishListIDByCoupleID(item.CoupleID);

            sql        = "CREATE_RECORD_LISTITEM";
            parameters = new Dictionary <string, object> {
                { "@desc", item.Description },
                { "@price", item.Price },
                { "@pos", item.Position },
                { "@list", listId }
            };
            ExecuteWriteSQLCommand();
            return(true);
        }
Пример #4
0
        public List <AddWishlistItem> GetListItemsForCouple(int listID)
        {
            sql        = "READ_RECORD_LIST_ITEM_COUPLE";
            parameters = new Dictionary <string, object> {
                { "@list", listID }
            };
            var result = ExecuteReadSQLCommand();
            List <AddWishlistItem> wishlist = new List <AddWishlistItem>();

            if (result.Count > 0)
            {
                foreach (var item in result)
                {
                    AddWishlistItem listItem = new AddWishlistItem
                    {
                        Description = (string)item.GetValueOrDefault("Description"),
                        Price       = (decimal)item.GetValueOrDefault("Price"),
                        Position    = (int)item.GetValueOrDefault("Position")
                    };
                    wishlist.Add(listItem);
                }
            }
            return(wishlist);
        }
Пример #5
0
 public ActionResult <bool> AddNewListItem([FromBody] AddWishlistItem newItem)
 {
     return(ListItem.AddNewItem(newItem));
 }