私のモデルはこのようなものです:
public class ViewMessageFileModel
{
[Display(Name = "FileOptionId")]
public int ? FileOptionId { get; set; }
[Display(Name = "LeaveInMyInbox")]
public bool ? LeaveInMyInbox { get; set; }
IList<int> _fileforMyTeam;
public IList<int> FileForMyTeam
{
get
{
if (_fileforMyTeam == null) _fileforMyTeam = new List<int>();
return _fileforMyTeam;
}
set { this._fileforMyTeam = value; }
}
IList<int> _fileforfacility;
public IList<int> FileForFacility
{
get
{
if (_fileforfacility == null) _fileforfacility = new List<int>();
return _fileforfacility;
}
set { this._fileforfacility = value; }
}
//Similarly for other option
private IList<ViewUserGroupModel> _careTeam;
public IList<ViewUserGroupModel> CareTeamForFile
{
get
{
if (_careTeam == null) _careTeam = new List<ViewUserGroupModel>();
return _careTeam;
}
set { this._careTeam = value; }
}
}
このモデルを次のようにビューで使用したい
1- @Model.CareTeamForFile を反復するビューでケアケアチームフォーファイルリストを直接使用します。
ビューページで Model 要素を json に変換することは可能ですか。また、最善のアプローチを提案してください。