Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 public void PutContact(int id, Contact contact)
 {
     contact.Id = id;
     repository.Update(id, contact);
     repository.Save();
 }