private static Item Deprecated_CreateListItem(string listPublicKey) { gData = new DataMethods(); //string listPublicKey = "49c8f932"; // MAIN XMAS LIST //string listPublicKey = "c6e4d6de"; // STOCKING STUFFER LIST //string listPublicKey = "9634ec5"; // KELLI'S LIST //string listPublicKey = "1a292692"; // ESPRESSO MACHINES string itemTitle = "PlaySeat Challenge"; string itemDescription = "Seat for racing/gaming console"; string itemURL = "http://www.playseat.com/shop/us/us/playseat-challenge-seats/playseat-challenge-racing-seat.html"; string itemImageURL = "http://www.playseat.com/page_content_files/shop_content_images/challenge-seat2.jpg"; string itemSize = string.Empty; string itemColor = string.Empty; short itemQty = 1; decimal itemCost = 249.00m; decimal itemCostRangeStart = 0.00m; decimal itemCostRangeEnd = 0.00m; return gData.ListItem_Create(listPublicKey, itemTitle, itemDescription, itemCost, itemCostRangeStart, itemCostRangeEnd, itemSize, itemColor, itemQty, null, itemImageURL, itemURL); }
// POST api/ListItem/PostItem/ public HttpResponseMessage PostItem(API_ListItem item) { if (ModelState.IsValid) { var createdItem = new Item(); try { using (_dataMethods = new DataMethods()) { // Convert from the API to the Item var listItem = converter.ConvertFromAPI_ListItem(item); // Create the item createdItem = _dataMethods.ListItem_Create(item.ListPublicKey, listItem.Title, listItem.Description, listItem.Cost, listItem.CostRangeStart, listItem.CostRangeEnd, listItem.Size, listItem.Color, listItem.Qty, listItem.Ordinal, listItem.ImageURL, listItem.ItemURL); // Next, create an ItemShare for the item for all the associated ListShares foreach (var ls in _dataMethods.ListShare_GetAllByListPublicKey(item.ListPublicKey)) { _dataMethods.ItemShare_Create(ls.ListShareID, item.ItemID); } } } catch (Exception) { throw; } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, item); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = createdItem.PublicKey })); return response; } else { return Request.CreateResponse(HttpStatusCode.BadRequest); } }