public HttpResponseMessage PostContact(Contact item) { item = repository.Add(item); repository.Save(); var response = Request.CreateResponse<Contact>(HttpStatusCode.Created, item); string uri = Url.Link("DefaultApi", new { id = item.Id }); response.Headers.Location = new Uri(uri); return response; }
public void PutContact(int id, Contact contact) { contact.Id = id; repository.Update(id, contact); repository.Save(); }