public int SavePage(HtmlPageDto page) { var newpage = Mapper.Map<HtmlPageDto, HtmlPage>(page); if(page.PageId > 0) _pagerepos.Update(newpage); else _pagerepos.Insert(newpage); _unitOfWork.CommitChanges(); return 1; }
private HtmlPageDto CreateDefaultPage(HtmlPageDto page) { if (page == null) { page = new HtmlPageDto(); } if(string.IsNullOrEmpty(page.Title)){ page.Title = "Page Title"; } if (string.IsNullOrEmpty(page.ShortIntro)) { page.ShortIntro = "Page Intro"; } if (page.HtmlBlocks == null || page.HtmlBlocks.Count == 0) { page.HtmlBlocks = CreateDefaultHtmlBlock(); } return page; }