public async Task <IActionResult> OnPostAsync(Hotel hotel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await hotelService.CreateHotelAsync(hotel); return(RedirectToPage("GetAllHotels")); }
/// <summary> /// Onpost metode til at at sætte hotel ind i databasen /// </summary> /// <returns>Aflevere siden der indholder alle hoteller</returns> public IActionResult OnPost() { _hotelService.CreateHotelAsync(Hotel); return(RedirectToPage("GetAllHotels")); }
public async Task <IActionResult> OnPost() { await hotelService.CreateHotelAsync(newHotel); return(RedirectToPage("GetAllHotels")); }