// POST: api/Person public HttpResponseMessage Post(Person person) { PersonRepository.InsertPerson(person); var response = Request.CreateResponse(HttpStatusCode.Created, person); string url = Url.Link("DefaultApi", new { person.Id }); response.Headers.Location = new Uri(url); return response; }
/// <summary> /// Inserts the Person to database. /// </summary> public static void InsertPerson(Person person) { PersonDb.People.Add(person); PersonDb.SaveChanges(); }