Esempio n. 1
0
 public void Update(string title,
                    DateTime sendDate, DateTime?publishedDate, int visitCount,
                    string content, string description, string postImage, string slug,
                    int authorId, int tagId, int categoryId, AuthorRefrence author, Category category)
 {
     SetProperty(title,
                 sendDate, publishedDate, visitCount,
                 content, description, postImage, slug,
                 authorId, tagId, categoryId, author, category);
 }
Esempio n. 2
0
        private void SetProperty(string title,
                                 DateTime sendDate, DateTime?publishedDate, int visitCount,
                                 string content, string description, string postImage, string slug,
                                 int authorId, int tagId, int categoryId, AuthorRefrence author, Category category)
        {
            if (string.IsNullOrWhiteSpace(title))
            {
                throw new NullReferenceException("TitleCannot Be null");
            }

            if (sendDate == null)
            {
                throw new NullReferenceException("Send Date Cannot Be Null");
            }


            if (string.IsNullOrWhiteSpace(content))
            {
                throw new NullReferenceException("Content Be null");
            }


            if (string.IsNullOrWhiteSpace(description))
            {
                throw new NullReferenceException("Description Be null");
            }

            if (string.IsNullOrWhiteSpace(slug))
            {
                throw new NullReferenceException("slug Be null");
            }



            Title         = title;
            SendDate      = sendDate;
            PublishedDate = publishedDate;
            VisitCount    = visitCount;
            Content       = content;
            Description   = description;
            PostImage     = postImage;

            //Todo:Is That Correct
            Slug       = slug.CreateFreandlySlug();
            AuthorId   = authorId;
            TagId      = tagId;
            CategoryId = categoryId;
            Author     = author;
            Category   = category;
        }