Example #1
0
        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
        }
Example #2
0
 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
 }
Example #3
0
 public async Task <Hotel.Entities.Hotel> UpdateHotel(Hotel.Entities.Hotel hotel)
 {
     return(await _hotelRepository.UpdateHotel(hotel));
 }