Ejemplo n.º 1
0
 public async Task<HttpResponseMessage> Put(CountyModel county)
 {
     if(ModelState.IsValid && await countyService.UpdateAsync(Mapper.Map<ICounty>(county)))
     {
         return new HttpResponseMessage(HttpStatusCode.NoContent);
     }
     else
     {
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new county.
 /// </summary>
 /// <param name="county">The county to be created.</param>
 /// <returns></returns>
 public async Task<HttpResponseMessage> Post(CountyModel county)
 {
     if (await countyService.AddAsync(Mapper.Map<ICounty>(county)))
     {
         return new HttpResponseMessage(HttpStatusCode.Created);
     }
     else
     {
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }