예제 #1
0
        public HttpResponseMessage Delete(int id)
        {
            var repo = new FakeContactDatabase();
            repo.Delete(id);

            var response = Request.CreateResponse(HttpStatusCode.OK);

            return response;
        }
예제 #2
0
        public HttpResponseMessage Put(Contact contact)
        {
            var repo = new FakeContactDatabase();
            repo.Edit(contact);

            var response = Request.CreateResponse(HttpStatusCode.OK, contact);

            string uri = Url.Link("DefaultApi", new {id = contact.ContactID});
            response.Headers.Location = new Uri(uri);

            return response;
        }
예제 #3
0
 public Contact Get(int id)
 {
     var repo = new FakeContactDatabase();
     return repo.GetById(id);
 }
예제 #4
0
 public List<Contact> Get()
 {
     var repo = new FakeContactDatabase();
     return repo.GetAll();
 }