Exemple #1
0
 public IHttpActionResult Put([FromBody] ContactPutModel value)
 {
     //Checking if ModelState is invalid and throw exception
     if (!ModelState.IsValid)
     {
         //If ModelState fails validation, returns validation error response
         return(BadRequest(ModelState));
     }
     this._contactRepository.Put(value.ToEntity());
     //If ModelState validation is successed, returns as a response the Action API name, Contact Id and the model
     return(CreatedAtRoute("DefaultApi", new { id = value.ToEntity().ContactId }, new ContactModel(value.ToEntity())));
 }
Exemple #2
0
 // PUT: api/Contact/5
 public void Put([FromBody] ContactPutModel value)
 {
     this._contactRepository.Put(value.ToEntity());
 }