Exemple #1
0
 public ListShare ConvertFromAPI_ListShare(API_ListShare listShare)
 {
     using(var dataMethods = new DataMethods())
     {
         return new ListShare() {
             List = dataMethods.List_GetListByPublicKey(listShare.SharedList.PublicKey)
             ,UserConsumer = dataMethods.User_GetUser(listShare.ConsumerPublicKey)
             ,UserOwner = dataMethods.User_GetUser(listShare.OwnerPublicKey)
         };
     }
 }
        public IQueryable<API_ListItem> GetItemsForList(string id)
        {
            var rcListItem = new List<API_ListItem>();
            if (id != string.Empty)
            {
                using (_dataMethods = new DataMethods())
                {
                    var list = _dataMethods.List_GetListByPublicKey(id);
                    if (list == null)
                    {
                        throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
                    }
                    else
                    {
                        // Convert each ListItem to an API_ListItem
                        foreach (var i in list.Items)
                        {
                            rcListItem.Add(converter.ConvertToAPI_ListItem(i, id));
                        }
                    }
                }
            }
            else
            {
                throw new HttpException("List Public Key not Provided!");
            }

            return rcListItem.AsQueryable();
        }