public Article Convert() { int articleId; var article = new Article { ArticleId = this.ArticleId.MaybeAs <string>().Bind(c => string.IsNullOrEmpty(c) ? 0 : int.Parse(c)).GetOrDefault(0), AuthorName = this.AuthorName, InitialText = this.Content, ArticleName = this.ArticleName, Link = this.Link, ArticleGroup = this.Group == null ? null : new ArticleGroup { GroupName = this.Group }, Rate = this.Rate }; if (this.ImageIds != null) { var results = CommonHelper.Instance.TempFiles.Where(c => ImageIds.Contains(c.GuidId.ToString())); article.Images = new List <Image>(); article.Images.AddRange(results.Select(c => new Image() { Data = c.ImageData, Name = c.Name, })); if (article.ArticleId != 0) { var helper = new IocHelper(); var expArticle = helper.ArticleService.GetArticleById(article.ArticleId); article.Images.AddRange(expArticle.Images); } } if (this.Tags != null) { article.Tags = Tags; } return(article); }