예제 #1
0
        // POST api/Titles
        public HttpResponseMessage PostTitle(Title title)
        {
            if (ModelState.IsValid)
            {
                db.Titles.Add(title);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, title);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = title.TitleId }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
예제 #2
0
 // PUT api/Titles/5
 public HttpResponseMessage PutTitle(Title title)
 {
     return Request.CreateResponse(HttpStatusCode.NotImplemented);
 }