예제 #1
0
        // POST api/values
        public HttpResponseMessage Post([FromBody] Student item)
        {
            Student entity = this.repository.Add(item);

            StudentModel model = StudentModel.CreateModelFromEntity(entity);

            HttpResponseMessage response =
                this.Request.CreateResponse(HttpStatusCode.Created, model);

            response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = model.StudentId }));

            return(response);
        }