public async Task <IActionResult> AddHotel([FromBody] HotelDTO hotel)
        {
            if (ModelState.IsValid)
            {
                hotel = await _hotelService.Add(hotel);

                return(Ok(hotel));
            }
            return(BadRequest(ModelState));
        }
Exemple #2
0
        public async Task <IActionResult> Add(HotelViewModel model, List <IFormFile> imageList)
        {
            if (!ModelState.IsValid)
            {
                model.PropertyTypes = await propertyTypeService.FindAll();

                return(View(model));
            }
            model.Hotel.ApplicationUserId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var hotel = await hotelService.Add(model.Hotel);

            await imageService.UploadImagesAsync(imageList, hotel.HotelId);

            return(RedirectToAction(nameof(Hotel), new { id = hotel.HotelId }));
        }
Exemple #3
0
 public ActionResult <Hotel> Add([FromBody] Hotel hotel)
 {
     return(_hotelService.Add(hotel));
 }
        public IActionResult Add(Reservation reservation)
        {
            _hotelService.Add(reservation);

            return(Ok());
        }