public async Task Put(CityDTO item) { using (var repo = new CityRepository()) { City existing = await repo.GetById(item.Id); if (existing == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } item.Save(existing); await repo.Commit(); } }
public async Task <int> Post(CityDTO item) { using (var repo = new CityRepository()) { City city = new City(); item.Save(city); await repo.Create(city); await repo.Commit(); return(city.Id); } }