Overview : 탑승객 여러명 데이타를 model 에 넣기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
@model LBRs //::: 중략 ::// @using (Ajax.BeginForm("PaxInfo", "Reservation", new AjaxOptions() { HttpMethod = "POST" }, new { enctype = "multipart/form-data" })) { @*위조방지*@ @Html.AntiForgeryToken() @Html.Hidden("LandingJson", @ViewData["JsonResult"]) @{ PTCNumber = 0; int i = -1;} @foreach (LBPassenger pass in trip.passengers) //only 첫번째 trip { for (var j = 0; j < pass.paxCount.AsInt(); j++) //paxCount로 가져오기 { PTCNumber = PTCNumber + 1; i = i + 1; <tr> <td>@(String.Format("{0}{1}", "0", PTCNumber))</td> <td> @(string.Format("{0}{1}", (pass.paxType == "ADT" ? "성인" : (pass.paxType == "CHD" ? "소아" : "유아")), j + 1)) @Html.HiddenFor(m => m.domLandingRes.Bpassengers[i].paxType, new { @id = (String.Format("{0}{1}", "paxType", PTCNumber)), Value = pass.paxType }) @Html.HiddenFor(m => m.domLandingRes.Bpassengers[i].fareType, new { @id = (String.Format("{0}{1}", "fareType", PTCNumber)), Value = pass.fareType }) </td> <td> <label class="input last-name"> <div class="in"> <span class="ph">예) 홍</span> @Html.TextBoxFor(m => m.domLandingRes.Bpassengers[i].lastName, new { Required = true, @id = String.Format("{0}{1}", "paxLN", PTCNumber), @maxlength = "20", @onblur = "onlyChar(this);" }) </div> </label> <label class="input first-name"> <div class="in"> <span class="ph">예) 길동</span> @Html.TextBoxFor(m => m.domLandingRes.Bpassengers[i].firstName, new { Required = true, @id = String.Format("{0}{1}", "paxFN", PTCNumber), @style = "ime-mode:active;", @maxlength = "25", @onblur = "onlyChar(this);" }) </div> </label> <!--input type='hidden' id="passengername1" value="" /--> </td> <td> <label class="select gender"> @{ var selectGenderList = new SelectList( new List<SelectListItem> { new SelectListItem { Selected = true, Text = "남자", Value = "M" }, new SelectListItem { Text = "여자", Value = "F" }, }, "Value", "Text"); } @Html.DropDownListFor(m => m.domLandingRes.Bpassengers[i].gender, selectGenderList, null, new { @class = "css-class" }) </label> </td> <td> <label class="input birthday"> <div class="in"> <span class="ph">예) 19800101</span> @Html.TextBoxFor(m => m.domLandingRes.Bpassengers[i].birthDate, new { Required = true, @id = String.Format("{0}{1}", "paxBT", PTCNumber), @style = "ime-mode:disabled;", @maxlength = "8", @onKeyUp = "isNumber(this);" }) </div> </label> </td> </tr> } } } |