Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. [ServiceContract]
  2.     public class ContactsResource
  3.     {
  4.         private IContactRepository repository;
  5.  
  6.         public ContactsResource(IContactRepository repo)
  7.         {
  8.             this.repository=repo;
  9.         }
  10.  
  11.         [WebGet(UriTemplate="")]
  12.         public List<Contact> Get()
  13.         {
  14.             return repository.GetAll();
  15.         }
  16.  
  17.         [WebInvoke(UriTemplate ="", Method="POST")]
  18.         public HttpResponseMessage<Contact> Post(Contact contact)
  19.         {
  20.             repository.Post(contact);
  21.             var response = new HttpResponseMessage<Contact>(contact);
  22.             response.StatusCode = HttpStatusCode.Created;
  23.             return response;
  24.         }
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top