// GET: odata/Course public IHttpActionResult GetCourse(ODataQueryOptions<CourseModels> queryOptions) { // validate the query. try { queryOptions.Validate(_validationSettings); } catch (ODataException ex) { return BadRequest(ex.Message); } CourseModels result = new CourseModels { Id = Guid.NewGuid(), Name = "My Sample Course" }; List<CourseModels> a = new List<CourseModels> { result }; return Ok<IEnumerable<CourseModels>>(a); // return Ok<IEnumerable<CourseModels>>(courseModels); return StatusCode(HttpStatusCode.NotImplemented); }
// Add New // POST: odata/Course public IHttpActionResult Post(CourseModels courseModels) { if (!ModelState.IsValid) { return BadRequest(ModelState); } // TODO: Add create logic here. // return Created(courseModels); return StatusCode(HttpStatusCode.NotImplemented); }