예제 #1
0
 public dynamic GetContact(Contact  contact)
 {
     if (string.IsNullOrEmpty(contact.Name))
     {
         this.ModelState.AddModelError("Name", "Name字段是必须的.");
     }
     if (ModelState.IsValid)
     {
         return Request.CreateResponse<Contact>(contact);
     }
     else
     {
         return Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, this.ModelState);
     }
 }
예제 #2
0
 public Contact GetContact(Contact contact)
 {
     return contact;
 }