// Где происходит вставка паршиал вью
@foreach ( var post in Model.CompanyPosts )
{
< tr>
@Html.Action ( "DisplayInputForm" , new { cp = post, num = i } )
</ div>
</ tr>
{
i++;
}
}
// само паршил вью
@using ( @Ajax.BeginForm ( "Edit" , "CompanyPosts" , FormMethod.Post , new AjaxOptions( ) { UpdateTargetId = "row_" + Model.FormNumber , InsertionMode = InsertionMode.Replace } , new { role = "form" , id = "form" + @Model.FormNumber } ) )
{
@Html.Hidden ( "FormNumber" , Model.FormNumber )
@Html.Hidden ( "CompanyPost.Id" , Model.CompanyPost .Id )
< td class= "custom_cell" >
@Html.TextBox ( "CompanyPost.PostName" , Model.CompanyPost .Post .Name , new { @class = "form-control input_in_cell" , onchange = "return form" + @Model.FormNumber + ".submit()" } )
</ td>
< td class= "custom_cell" >
@Html.TextBox ( "CompanyPost.Rate" , Model.CompanyPost .Rate , new { @class = "form-control input_in_cell" , onchange = "return form" + @Model.FormNumber + ".submit()" } )
</ td>
}
// методы гет и пост паршиал вью
public PartialViewResult DisplayInputForm( CompanyPosts cp, int num)
{
CompanyPostsInputViewModel model = new CompanyPostsInputViewModel( )
{
CompanyPost = cp,
FormNumber = num
} ;
return PartialView( model) ;
}
[ HttpPost]
public PartialViewResult Edit( CompanyPostsInputViewModel model)
{
if ( ModelState.IsValid )
{
service.SaveCompanyPosts ( model.CompanyPost ) ;
}
return PartialView( "DisplayInputForm" , model) ;
}
Ci8vINCT0LTQtSDQv9GA0L7QuNGB0YXQvtC00LjRgiDQstGB0YLQsNCy0LrQsCDQv9Cw0YDRiNC40LDQuyDQstGM0Y4gIAogICAgICAgICAgICBAZm9yZWFjaCAodmFyIHBvc3QgaW4gTW9kZWwuQ29tcGFueVBvc3RzKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICA8dHI+CgogICAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9J3Jvd19AaSc+CiAgICAgICAgICAgICAgICAgICAgICAgIEBIdG1sLkFjdGlvbigiRGlzcGxheUlucHV0R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W55UG9zdC5SYXRlLCBuZXcgeyBAY2xhc3MgPSAiZm9ybS1jb250cm9sIGlucHV0X2luX2NlbGwiLCBvbmNoYW5nZSA9ICJyZXR1cm4gZm9ybSIgKyBATW9kZWwuRm9ybU51bWJlciArICIuc3VibWl0KCkiIH0pCiAgICA8L3RkPgp9Ci8vINC80LXRgtC+0LTRiyDQs9C10YIg0Lgg0L/QvtGB0YIg0L/QsNGA0YjQuNCw0Lsg0LLRjNGOCiAgICAgICAgcHVibGljIFBhcnRpYWxWaWV3UmVzdWx0IERpc3BsYXlJbnB1dEZvcm0oQ29tcGFueVBvc3RzIGNwLCBpbnQgbnVtKQogICAgICAgIHsKICAgICAgICAgICAgQ29tcGFueVBvc3RzSW5wdXRWaWV3TW9kZWwgbW9kZWwgPSBuZXcgQ29tcGFueVBvc3RzSW5wdXRWaWV3TW9kZWwoKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb21wYW55UG9zdCA9IGNwLAogICAgICAgICAgICAgICAgRm9ybU51bWJlciA9IG51bQogICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIFBhcnRpYWxWaWV3KG1vZGVsKTsKICAgICAgICB9CgogICAgICAgIFtIdHRwUG9zdF0KICAgICAgICBwdWJsaWMgUGFydGlhbFZpZXdSZXN1bHQgRWRpdChDb21wYW55UG9zdHNJbnB1dFZpZXdNb2RlbCBtb2RlbCkKICAgICAgICB7CiAgICAgICAgICAgIGlmIChNb2RlbFN0YXRlLklzVmFsaWQpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHNlcnZpY2UuU2F2ZUNvbXBhbnlQb3N0cyhtb2RlbC5Db21wYW55UG9zdCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIFBhcnRpYWxWaWV3KCJEaXNwbGF5SW5wdXRGb3JtIiwgbW9kZWwpOwogICAgICAgIH0=
compilation info
prog.cs(3,13): error CS1525: Unexpected symbol `foreach'
prog.cs(7,29): error CS1012: Too many characters in character literal
Compilation failed: 2 error(s), 0 warnings
stdout