示例#1
0
        public bool MoveItem(bool up, EditWishListItem item)
        {
            List <AddWishlistItem> items = GetListItemsForCouple(item.ListID);

            foreach (var listItem in items)
            {
                int newPosition = (up) ? item.Position - 1 : item.Position + 1;
                int position;
                if (listItem.Position == newPosition || listItem.Position == item.Position)
                {
                    if (listItem.Position == newPosition)
                    {
                        position = (up) ? listItem.Position + 1 : listItem.Position - 1;
                    }
                    else
                    {
                        position = newPosition;
                    }

                    sql        = "UPDATE_RECORD_LISTITEM_ORDER";
                    parameters = new Dictionary <string, object>
                    {
                        { "@desc", listItem.Description },
                        { "@price", listItem.Price },
                        { "@pos", position },
                        { "@list", item.ListID }
                    };
                    ExecuteWriteSQLCommand();
                }
            }
            return(true);
        }
示例#2
0
 public bool EditItem(EditWishListItem item)
 {
     sql        = "UPDATE_RECORD_LISTITEM";
     parameters = new Dictionary <string, object> {
         { "@desc", item.Description },
         { "@price", item.Price },
         { "@pos", item.Position },
         { "@list", item.ListID }
     };
     ExecuteWriteSQLCommand();
     return(true);
 }
示例#3
0
 public ActionResult <bool> ChangePositionDown([FromBody] EditWishListItem item)
 {
     return(ListItem.MoveItem(false, item));
 }
示例#4
0
 public ActionResult <bool> EditListItem([FromBody] EditWishListItem item)
 {
     return(ListItem.EditItem(item));
 }