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); } }
/// <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); } }