Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: How to query form xml data using odata

$
0
0
I would guess you would do this (basically include your namespace and replace IPage with program - I also renamed the controller class here:
using System.Linq;
using System.Web.Http;
using System.Web.Http.OData.Query;
using Composite.Data;
using Composite.Data.Types;
using ch7.program;

namespace Composite.Controllers
{

public class ProgramsController : ApiController
{
    [Queryable]
   public IQueryable<program> Get(ODataQueryOptions<program> options)
    {
        using (var c = new DataConnection())
        { 
            var querySettings = new ODataQuerySettings();

            return options.ApplyTo(c.Get<program>(), querySettings).Cast<program>().ToList().AsQueryable();
       }
    }
}

}
I find it a bit weird that your type has the same name as your namespace (both have "program") so if the above doesn't compile, look into this.

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>