public void EditPost(ContentRegistrationPM contentPresentationModel, IEnumerable <string> tags) { var content = contentPresentationModel.GetContent(); content.Text = HtmlParser.Parse(content.Text); content.Text = HtmlMinifier.MinifyHtml(content.Text); ContentBiz.UpdateContent(content, tags); UnitOfWork.SaveChanges(); }
public void ReadPostForEdit(UserIdentity userIdentity, int contentId, out ContentRegistrationPM contentPresentationModel, out List <string> tags) { var content = ContentBiz.Read(c => c.AuthorId == userIdentity.UserId && c.Type == ContentType.BlogPost && c.State != ContentState.Blocked && c.Id == contentId) .Include(c => c.Tags) .Single(c => c.Id == contentId); contentPresentationModel = content.GetContentRegistrationPM(); tags = new List <string>(content.Tags.Select(tag => tag.Text)); }
public void AddArticle(ContentRegistrationPM contentPresentationModel, IEnumerable <string> tags) { var content = contentPresentationModel.GetContent(); content.Type = ContentType.Article; content.CultureLcid = CultureInfo.GetCultureInfo("fa-IR").LCID; content.Text = HtmlParser.Parse(content.Text); content.Text = HtmlMinifier.MinifyHtml(content.Text); ArticleBiz.AddContent(content, tags); UnitOfWork.SaveChanges(); contentPresentationModel.Id = content.Id; }
public void AddPost(int blogId, ContentRegistrationPM contentPresentationModel, IEnumerable <string> tags) { var content = contentPresentationModel.GetContent(); content.Type = ContentType.BlogPost; content.CultureLcid = CultureInfo.GetCultureInfo("fa-IR").LCID; content.Text = HtmlParser.Parse(content.Text); content.Text = HtmlMinifier.MinifyHtml(content.Text); content.PublicationId = blogId; ContentBiz.AddContent(content, tags); UnitOfWork.SaveChanges(); contentPresentationModel.Id = content.Id; }
public static Content GetContent(this ContentRegistrationPM contentPresentationModel) { return(AutoMapper.Mapper.Map <ContentRegistrationPM, Content>(contentPresentationModel)); }