public async Task <IActionResult> PutAmenity(int id, Amenity amenity) { if (id != amenity.Id) { return(BadRequest()); } //_context.Entry(amenity).State = EntityState.Modified; var updatedAmenity = await _amenity.Update(amenity); return(Ok(updatedAmenity)); //try //{ // await _context.SaveChangesAsync(); //} //catch (DbUpdateConcurrencyException) //{ // if (id != amenity.Id) // { // return NotFound(); // } // else // { // throw; // } //} //return NoContent(); }
public async Task <IActionResult> PutAmenity(int id, Amenity amenity) { if (id != amenity.Id) { return(BadRequest()); } await _amenity.Update(amenity); return(Ok()); }
public async Task <IActionResult> PutAmenity(int id, AmenityDTO amenityDto) { if (id != amenityDto.ID) { return(BadRequest()); } var updatedAmenity = await _amenity.Update(amenityDto); return(Ok(updatedAmenity)); }