コード例 #1
0
 public static CommitteeViewModel fromCommittee(Committee committee)
 {
     return new CommitteeViewModel() {
         committee = committee,
         Name = committee.name,
         Chamber = committee.chamber
     };
 }
コード例 #2
0
        public static Committee oneFromJObject(JObject root)
        {
            Committee committee = new Committee();

            committee.id = (string)root["id"];
            committee.name = (string)root["name"];
            committee.chamber = (string)root["chamber"];

            JToken membersToken = root["members"];
            if (membersToken != null) {
                committee.members = new Collection<Legislator>();

                JArray membersRoot = (JArray)membersToken;
                foreach (JToken item in membersRoot) {
                    JObject itemRoot = (JObject)((JObject)item)["legislator"];
                    committee.members.Add(Legislator.oneFromJObject(itemRoot));
                }
            }

            return committee;
        }