public PostViewModel( int id, string title, string content, bool isActive, string headerPhotoPath, DateTime publishDate, Domain.Models.Blog blog = null, Domain.Models.Category category = null) { Id = id; Title = title; Content = content; HeaderPhotoPath = headerPhotoPath; IsActive = isActive; Url = ContentUrlGenerator.GenerateUrl(id, title); PublishDate = publishDate.ToShortDateString(); if (blog != null) { Blog = new BlogViewModel(blog.Id, blog.Title); } if (category != null) { Category = new CategoryViewModel(category.Id, category.Title); } }
public BlogViewModel(int id, string title) { Id = id; Title = title; Url = ContentUrlGenerator.GenerateUrl(id, title); }