public static CommitteeViewModel fromCommittee(Committee committee)
 {
     return new CommitteeViewModel() {
         committee = committee,
         Name = committee.name,
         Chamber = committee.chamber
     };
 }
Exemplo n.º 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;
        }