我想要分开的朋友 facebook 和 twitter。像这样 :
推特 脸书
编辑器模板: FriendModel.cshtml
@model App.Web.Models.FriendModel
<div>
<input type="checkbox" name="saveInputs" value="@Model.FriendID"/>
<img alt="" src="@Model.ProfileImageUrl" />
<strong>@Model.Name</strong> Friends: <strong>@Model.FriendsCount</strong>
</div>
<br />
浏览量: FriendTeam.cshtml
@model App.Web.Models.FriendTeamModel
@{
ViewBag.Title = "FriendTeam";
}
<h2>
FriendTeam</h2>
@using (@Html.BeginForm())
{ @Html.ValidationSummary(true)
<h3>Twitter</h3>
<br />
@Html.EditorFor(model => model.Friends.Where(x=>x.SocialNetworkName=="Twitter"))
<h3>Facebook</h3>
<br />
@Html.EditorFor(model => model.Friends.Where(x=>x.SocialNetworkName=="Facebook"))
}
<div>
@Html.ActionLink("Back to List", "Index")
朋友团队型号:
public class FriendTeamModel
{
public long FriendTeam{ get; set; }
public IEnumerable<FriendModel> Friends { get; set; }
}
朋友型号:
public class FriendModel
{
public string FriendID { get; set; }
public string SocialNetworkName { get; set; }
public string Name { get; set; }
public int FriendsCount { get; set; }
public string ProfileImageUrl { get; set; }
}
错误 :
模型只能与房屋所有权的表达式访问字段、一维数组的索引或自定义索引器单个参数一起使用。
谢谢,