public async Task <IActionResult> PostHotel([FromBody] Hotel.Entities.Hotel hotel) { var createdHotel = await _hotelService.CreateHotel(hotel); return(CreatedAtAction("GetHotelById", new { id = createdHotel.Id }, createdHotel)); //dönen response un header kısmında oluşturulan otelin hangi url de oldugu da belirtilir }
public async Task <IActionResult> PutHotel([FromBody] Hotel.Entities.Hotel hotel) { if (await _hotelService.GetHotelById(hotel.Id) != null) { return(Ok(await _hotelService.UpdateHotel(hotel))); // 200 + guncellenen hotel } return(NotFound()); //404 }
public async Task <Hotel.Entities.Hotel> UpdateHotel(Hotel.Entities.Hotel hotel) { return(await _hotelRepository.UpdateHotel(hotel)); }