public CommentsCollectionState Create(comment model) { var comment = new CommentsCollectionState { id = model.id, message = model.message, date = model.initialDate.Value, userName = model.userInfo.name, userId = model.userInfo.id, //user = new UsersCollectionFactory(new UserLinkFactory(_request)).Create(model.userInfo), _links = new LinkCollection() }; comment._links.self = _links.Self(model.id); return(comment); }
public CommentSingleState Create(comment model) { var comment = new CommentSingleState() { id = model.id, message = model.message, date = model.initialDate.Value, user = new UsersCollectionFactory(new UserLinkFactory(_request)).Create(model.userInfo), _Links = new CommentSingleState.Link() }; comment._Links.Self = _links.Self(model.id); if (model.@event != null) { comment.@event = new EventsCollectionFactory(new EventLinkFactory(_request)).Create(model.@event); comment._Links.Event = _links.Event(model.eventId.Value); } else { comment.community = new CommunitiesCollectionFactory(new CommunityLinkFactory(_request)).Create(model.community); comment._Links.Community = _links.Community(model.communityId.Value); } return(comment); }