public void UpdatePage(Page page) { var original = _heartService.GetHeart(page.HeartId); using (var ts = new TransactionScope()) { _heartService.UpdateHeart(page); var dataPage = Mapper.Map <Data.Models.Page>(page); _pageGateway.Update(dataPage); page.CanonicalUrl = _heartService.GetCanonicalUrl(page.RelativeUrl); _searchService.UpdateIndex(page); ts.Complete(); } RemoveObjectFromCache(GetPageCacheKey(original.RelativeUrl)); }
public int CreatePage(Page page) { page.Type = page.GetType().FullName; int heartId; using (var ts = new TransactionScope()) { heartId = _heartService.CreateHeart(page); page.HeartId = heartId; var newPage = Mapper.Map <Data.Models.Page>(page); _pageGateway.Insert(newPage); page.CanonicalUrl = _heartService.GetCanonicalUrl(page.RelativeUrl); _searchService.UpdateIndex(page); ts.Complete(); } AddOrUpdateCacheObject(GetPageCacheKey(page.RelativeUrl), page); return(heartId); }