Beispiel #1
0
        // POST api/video
        public HttpResponseMessage Post(Video video)
        {
            if (ModelState.IsValid)
            {
                db.Videos.Add(video);
                db.SaveChanges();

                //TODO: BOOKMARK
            }

            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }
Beispiel #2
0
        // POST api/video
        public HttpResponseMessage Post(Video video)
        {
            if (ModelState.IsValid)
            {
                db.Videos.Add(video);
                db.SaveChanges();

                var response = Request.CreateResponse(HttpStatusCode.Created, video);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = video.Id }));
                return(response);
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }