Esempio n. 1
0
        /// <summary>
        /// NOTE: THIS WAS ALL AUTO-GENED BY VS2012
        /// </summary>
        // GET api/ListShare
        public IQueryable<API_ListShare>GetListShares()
        {
            API_ListShare converter = new API_ListShare();
            var rcListShares = new List<API_ListShare>();

            using (var dataMethods = new Data.DataMethods())
            {
                var listshares = dataMethods.ListShare_GetAll();
                if (listshares != null)
                {
                    foreach (var s in listshares)
                    {
                        var newItem = converter.ConvertToAPI_ListShareWithAssociatedList(s);
                        rcListShares.Add(newItem);
                    }
                }
            }

            return rcListShares.AsQueryable();
        }
Esempio n. 2
0
        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();
        }