예제 #1
0
 public async Task<HttpResponseMessage> Put(LocationModel location)
 {
     if (ModelState.IsValid && await locationService.UpdateAsync(Mapper.Map<ILocation>(location)))
     {
         return new HttpResponseMessage(HttpStatusCode.NoContent);
     }
     else
     {
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }
예제 #2
0
 /// <summary>
 /// Creates a new location.
 /// </summary>
 /// <param name="location">The location.</param>
 /// <returns></returns>
 public async Task<HttpResponseMessage> Post(LocationModel location)
 {
     if (await locationService.AddAsync(Mapper.Map<ILocation>(location)))
     {
         return new HttpResponseMessage(HttpStatusCode.Created);
     }
     else
     {
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
 }