From 5c84ac5851c81636599738f396a25734c3d1e52e Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Thu, 23 Aug 2018 22:45:12 +0200 Subject: [PATCH] Add form elements to the FormHotel --- Plattform/Plattform/FormHotel.aspx | 3 ++- Plattform/Plattform/FormHotel.aspx.cs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Plattform/Plattform/FormHotel.aspx b/Plattform/Plattform/FormHotel.aspx index 4719712..a1bb51f 100644 --- a/Plattform/Plattform/FormHotel.aspx +++ b/Plattform/Plattform/FormHotel.aspx @@ -8,11 +8,12 @@
+

Home

Add a new hotel

Name
Zip Code
- +
City

diff --git a/Plattform/Plattform/FormHotel.aspx.cs b/Plattform/Plattform/FormHotel.aspx.cs index 46e6897..82a49c5 100644 --- a/Plattform/Plattform/FormHotel.aspx.cs +++ b/Plattform/Plattform/FormHotel.aspx.cs @@ -4,6 +4,9 @@ using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Plattform.DB; +using Plattform.Models; + namespace Plattform { @@ -31,7 +34,17 @@ namespace Plattform protected void ButtonAddHotel_Click(object sender, EventArgs e) { - + HotelDB hotelDB = new HotelDB(); + Hotel hotel = new Hotel + { + Name = TextBoxHotelName.Text, + City = new City + { + ZipCode = int.Parse(TextBoxZipCode.Text), + Name = TextBoxCityName.Text + } + }; + hotelDB.CreateHotel(hotel); } } } \ No newline at end of file