My Model is Like this:
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; }
}
}
I want to use this model in my view as follows
1-Use of care careteamforfile list directly in view iterating through @Model.CareTeamForFile .But I want to use Fileforfacility and fileformyteam List to store in a json variable in view based on the value of which i have to select or deselect some checkboxes
Is this possible for me to convert the Model element to json on view page. Also suggest me the best approach.