Ejemplo n.º 1
0
        // 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);
        }
Ejemplo n.º 2
0
        // 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);
        }