public static ArticleEntity ToArticleEntity(this ArticleViewModel model) { var art = new ArticleEntity() { Id = model.Id, BlogId = model.BlogId, Content = model.Content, DateAdded = model.TimeAdded, ImagePath = model.ImagePath, Name = model.Title, Author = model.Author }; if (model.Tags.Count != 0) { var sb = new StringBuilder(); foreach (var tag in model.Tags) { sb.Append(tag.TagField); sb.Append(','); } sb.Remove(sb.Length - 1, 1); art.Tags = sb.ToString(); } return art; }
public void UpdateArticle(ArticleEntity article) { repository.Update(article.ToDalArticle()); uow.Commit(); }