Пример #1
0
        /// <summary>
        /// Instantiate and deserialize the properties of a <paramref name="Usergroup"/>
        /// </summary>
        /// <param name="jObject">The <see cref="JObject"/> containing the data</param>
        /// <returns>The <see cref="User"/> to instantiate</returns>
        public static Usergroup FromJsonObject(JObject jObject)
        {
            var iid = jObject["uuid"].ToObject <Guid>();

            var usergroup = new Usergroup
            {
                Uuid = iid
            };

            if (!jObject["modifiedOn"].IsNullOrEmpty())
            {
                usergroup.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>();
            }

            if (!jObject["createdOn"].IsNullOrEmpty())
            {
                usergroup.CreatedOn = jObject["createdOn"].ToObject <DateTime>();
            }

            if (!jObject["name"].IsNullOrEmpty())
            {
                usergroup.Name = jObject["name"].ToObject <string>();
            }

            if (!jObject["permissions"].IsNullOrEmpty())
            {
                usergroup.Permissions.AddRange(jObject["permissions"].ToObject <IEnumerable <string> >());
            }

            After(usergroup, jObject);
            return(usergroup);
        }
Пример #2
0
 /// <summary>
 /// Fills the object with the appropriate extra properties.
 /// </summary>
 /// <param name="usergroup">The user object.</param>
 /// <param name="jObject">The json object to deserialize from.</param>
 public static void After(Usergroup usergroup, JObject jObject)
 {
 }