public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { bool bNew = false; carrot_ContentTag s = CompiledQueries.cqGetContentTagByID(_db, this.ContentTagID); if (s == null || (s != null && s.ContentTagID == Guid.Empty)) { s = new carrot_ContentTag(); s.ContentTagID = Guid.NewGuid(); s.SiteID = this.SiteID; bNew = true; } s.TagSlug = ContentPageHelper.ScrubSlug(this.TagSlug); s.TagText = this.TagText; s.IsPublic = this.IsPublic; if (bNew) { _db.carrot_ContentTags.InsertOnSubmit(s); } _db.SubmitChanges(); this.ContentTagID = s.ContentTagID; } }
internal ContentTag(carrot_ContentTag c) { if (c != null) { this.ContentTagID = c.ContentTagID; this.SiteID = c.SiteID; this.TagSlug = c.TagSlug; this.TagText = c.TagText; this.IsPublic = c.IsPublic; } }
public static ContentTag Get(Guid TagID) { ContentTag _item = null; using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_ContentTag query = CompiledQueries.cqGetContentTagByID(_db, TagID); if (query != null) { _item = new ContentTag(query); } } return(_item); }
public void Delete() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_ContentTag s = CompiledQueries.cqGetContentTagByID(_db, this.ContentTagID); if (s != null) { IQueryable <carrot_TagContentMapping> lst = (from m in _db.carrot_TagContentMappings where m.ContentTagID == s.ContentTagID select m); _db.carrot_TagContentMappings.BatchDelete(lst); _db.carrot_ContentTags.DeleteOnSubmit(s); _db.SubmitChanges(); } } }
internal ContentTag(carrot_ContentTag c) { if (c != null) { this.ContentTagID = c.ContentTagID; this.SiteID = c.SiteID; this.TagSlug = ContentPageHelper.ScrubSlug(c.TagSlug); this.TagText = c.TagText; this.IsPublic = c.IsPublic; this.UseCount = 1; this.PublicUseCount = 1; SiteData site = SiteData.GetSiteFromCache(c.SiteID); if (site != null) { this.TagURL = ContentPageHelper.ScrubFilename(c.ContentTagID, String.Format("/{0}/{1}.aspx", site.BlogTagPath, c.TagSlug.Trim())); } } }
internal ContentTag(carrot_ContentTag c) { if (c != null) { this.ContentTagID = c.ContentTagID; this.SiteID = c.SiteID; this.TagSlug = ContentPageHelper.ScrubSlug(c.TagSlug); this.TagText = c.TagText; this.IsPublic = c.IsPublic; this.UseCount = 1; this.PublicUseCount = 1; SiteData site = SiteData.GetSiteFromCache(c.SiteID); if (site != null) { this.TagURL = ContentPageHelper.ScrubFilename(c.ContentTagID, String.Format("/{0}/{1}", site.BlogTagPath, c.TagSlug)); } } }