public async Task <ActionResult> Create(Hotel hotel) { try { AppacitiveRepository.HotelRepository hotelRepository = new HotelRepository(); Model.Hotel facadeHotel = new Model.Hotel(); facadeHotel.Id = 1; facadeHotel.Name = hotel.Name; facadeHotel.StarRating = hotel.StarRating; await hotelRepository.Create(facadeHotel); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <bool> Create(Model.Hotel hotel) { var apiHotel = new APHotel("hotel"); apiHotel.name = hotel.Name; apiHotel.Id = hotel.Id + 1; apiHotel.starrating = hotel.StarRating; try { await apiHotel.SaveAsync(); //var conn = await APConnection.New("hotel") // .ToNewObject("hotel", apiHotel) // .SaveAsync(); } catch (Exception e) { return(false); } return(true); }