private void GetAuthors(Blog blog, BlogMLBlog blogMLBlog) { foreach (var blogMLAuthor in blogMLBlog.Authors) { Author author = new Author(); author.ID = blogMLAuthor.ID; author.Approved = blogMLAuthor.Approved; author.DateCreated = blogMLAuthor.DateCreated; author.DateModified = blogMLAuthor.DateModified; author.Email = blogMLAuthor.Email; author.Title = blogMLAuthor.Title; blog.Authors.AuthorList.Add(author); } }
private string GetAuthorReference(Blog blog, string author) { string id = Constants.Slug(author); IEnumerable<Author> authors = from a in blog.Authors.AuthorList where a.ID == id select a; if (!authors.Any()) { // Author not found - let's create them! Author newAuthor = new Author(); newAuthor.ID = id; newAuthor.Email = id + "@" + (new Uri(blog.RootURL)).Host; newAuthor.Title = author; blog.Authors.AuthorList.Add(newAuthor); } return id; }