Esempio n. 1
0
        public QuestionSingleState Create(question model)
        {
            var question = new QuestionSingleState
            {
                id       = model.id,
                question = model.message,
                author   = new UsersCollectionFactory(new UserLinkFactory(_request)).Create(model.userInfo),
                session  = new SessionsCollectionFactory(new SessionLinkFactory(_request)).Create(model.session),
                _links   = new QuestionSingleState.Link()
            };

            question._links.self    = _links.Self(model.id);
            question._links.session = _links.Session(model.sessionId.Value);
            question._links.author  = _links.User(model.authorId);
            return(question);
        }
Esempio n. 2
0
        public QuestionsCollectionState Create(question model)
        {
            var question = new QuestionsCollectionState
            {
                id         = model.id,
                question   = model.message,
                likes      = model.likes.Value,
                likers     = model.user_like.Select(elem => elem.id).ToArray(),
                authorId   = model.authorId,
                authorName = model.userInfo.name,
                _links     = new LinkCollection()
            };

            question._links.self = _links.Self(model.id);
            return(question);
        }