示例#1
0
        public DocumentDto(Documents document, string content = "", int likesCount = 0, string quillDelta = "")
        {
            if (document != null)
            {
                DocumentId       = document.DocumentId;
                ParentDocumentId = document.ParentDocumentId;
                ProjectId        = document.ProjectId;
                CreatorId        = document.CreatorId;
                Slug             = document.Slug;
                Title            = document.Title;
                Subtitle         = document.Subtitle;
                DateCreated      = document.DateCreated;
                IsDraft          = document.IsDraft;

                if (document.Creator != null)
                {
                    Creator = new UserShortDto(document.Creator);
                }

                if (document.Project != null)
                {
                    ProjectName = document.Project.Name;
                    ProjectSlug = document.Project.Slug;
                }

                if (document.ParentDocument != null)
                {
                    ParentDocumentSlug = document.ParentDocument.Slug;
                }
            }

            Content    = content;
            LikesCount = likesCount;
            QuillDelta = quillDelta;
        }
示例#2
0
        public TemplateDto(Templates template, string content = "", string quillDelta = "")
        {
            if (template != null)
            {
                TemplateId   = template.TemplateId;
                TemplateType = template.TemplateTypeSlug;
                ProjectId    = template.ProjectId;
                CreatorId    = template.CreatorId;
                Slug         = template.Slug;
                Title        = template.Title;
                Description  = template.Description;
                DateCreated  = template.DateCreated;

                if (template.Creator != null)
                {
                    Creator = new UserShortDto(template.Creator);
                }

                if (template.TemplateTypeSlugNavigation != null)
                {
                    System = template.TemplateTypeSlugNavigation.System;
                }

                if (template.Project != null)
                {
                    ProjectName = template.Project.Name;
                    ProjectSlug = template.Project.Slug;
                }
            }

            Content    = content;
            QuillDelta = quillDelta;
        }
示例#3
0
        public CommentDto(Comments comment, int likesCount = 0)
        {
            if (comment != null)
            {
                CommentId   = comment.CommentId;
                Content     = comment.Content;
                TimeCreated = comment.TimeCreated;

                if (comment.User != null)
                {
                    User = new UserShortDto(comment.User);
                }
            }

            LikesCount = likesCount;
        }