/ / pobierz pokój przez id - asp.net-mvc, asp.net-mvc-3

uzyskać pokój według id - asp.net-mvc, asp.net-mvc-3

Pracuję nad projektem rezerwacji hotelu w MVC 3 Tutaj wyświetlam pokoje: wprowadź opis obrazu tutaj

Kiedy klikam, aby zarezerwować romm, dostaję się tutaj:

wprowadź opis obrazu tutaj

Ale chcę uzyskać numer pokoju, który wybrałem bezpośrednio w polu formularza Formularz rezerwacji.

Oto mój widok tworzenia rezerwacji:

@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Reservation</legend>

<div class="editor-label">
@Html.LabelFor(model => model.Room_ID, "Room")
</div>
<div class="editor-field">
@Html.DropDownList("Room_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Room_ID)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Guest_ID, "Client")
</div>
<div class="editor-field">
@Html.DropDownList("Guest_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Guest_ID)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Data_Check_in)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Data_Check_in)
@Html.ValidationMessageFor(model => model.Data_Check_in)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Data_Check_out)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Data_Check_out)
@Html.ValidationMessageFor(model => model.Data_Check_out)
</div>



<div class="editor-label">
@Html.LabelFor(model => model.Preference_ID, "Preferinte")
</div>
<div class="editor-field">
@Html.DropDownList("Preference_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Preference_ID)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Price)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Price)
@Html.ValidationMessageFor(model => model.Price)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Card_ID, "Card_de_credit")
</div>
<div class="editor-field">
@Html.DropDownList("Card_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Card_ID)
</div>

<p>
<input type="submit" value="Create" />
</p>
</fieldset>

}

Odpowiedzi:

2 dla odpowiedzi № 1

Czy możesz przekazać identyfikator pokoju z pierwszej strony na stronę formularza za pomocą modelu widoku?