コード例 #1
0
            public static GeopoliticalLocationDbRep FromJsonSingle(string json)
            {
                GeopoliticalLocationDbRep local = JsonConvert.DeserializeObject <GeopoliticalLocationDbRep>(json);

                local.Names = JsonConvert.DeserializeObject <List <string> >(local.NamesJsonString);
                return(local);
            }
コード例 #2
0
ファイル: PostImpl.cs プロジェクト: cramt/QWest
            public Post ToModel()
            {
                User  userAuthor  = null;
                Group groupAuthor = null;

                if (UserId != null)
                {
                    userAuthor = new User(Username, PasswordHash, Email, UserDescription, SessionCookie, UserId)
                    {
                        ProfilePicture = ProfilePicture
                    };
                }
                else if (GroupId != null)
                {
                    groupAuthor = new Group(Name, (int)CreationTime, GroupDescription, null, Members.MapValue(UserDbRep.FromJson).Select(x => x.ToModel()), GroupId);
                }
                else
                {
                    throw new ArgumentException("in this post the author is neither a user or group");
                }
                return(new Post(Content, userAuthor, groupAuthor, PostTime, Images.MapValue(x => x.Split(',').Select(y => int.Parse(y)).ToList()), Location.MapValue(x => GeopoliticalLocationDbRep.ToTreeStructureFirst(GeopoliticalLocationDbRep.FromJson(x))), Id));
            }