public void Delete() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_ContentComment c = CompiledQueries.cqGetContentCommentsTblByID(_db, this.ContentCommentID); if (c != null) { _db.carrot_ContentComments.DeleteOnSubmit(c); _db.SubmitChanges(); } } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { bool bNew = false; carrot_ContentComment c = CompiledQueries.cqGetContentCommentsTblByID(_db, this.ContentCommentID); if (c == null) { c = new carrot_ContentComment(); c.CreateDate = DateTime.UtcNow; bNew = true; if (this.CreateDate.Year > 1950) { c.CreateDate = SiteData.CurrentSite.ConvertSiteTimeToUTC(this.CreateDate); } } if (this.ContentCommentID == Guid.Empty) { this.ContentCommentID = Guid.NewGuid(); } c.ContentCommentID = this.ContentCommentID; c.Root_ContentID = this.Root_ContentID; c.CommenterIP = this.CommenterIP; c.CommenterName = this.CommenterName; c.CommenterEmail = this.CommenterEmail; c.CommenterURL = this.CommenterURL; c.PostComment = this.PostCommentText; c.IsApproved = this.IsApproved; c.IsSpam = this.IsSpam; if (bNew) { _db.carrot_ContentComments.InsertOnSubmit(c); } _db.SubmitChanges(); this.ContentCommentID = c.ContentCommentID; this.CreateDate = c.CreateDate; } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { bool bNew = false; carrot_ContentComment c = CompiledQueries.cqGetContentCommentsTblByID(_db, this.ContentCommentID); if (c == null) { c = new carrot_ContentComment(); c.CreateDate = DateTime.UtcNow; bNew = true; if (this.CreateDate.Year > 1950) { c.CreateDate = SiteData.CurrentSite.ConvertSiteTimeToUTC(this.CreateDate); } } if (this.ContentCommentID == Guid.Empty) { this.ContentCommentID = Guid.NewGuid(); } c.ContentCommentID = this.ContentCommentID; c.Root_ContentID = this.Root_ContentID; c.CommenterIP = this.CommenterIP; c.CommenterName = this.CommenterName; c.CommenterEmail = this.CommenterEmail; c.CommenterURL = this.CommenterURL; c.PostComment = this.PostCommentText; c.IsApproved = this.IsApproved; c.IsSpam = this.IsSpam; if (bNew) { _db.carrot_ContentComments.InsertOnSubmit(c); } _db.SubmitChanges(); this.ContentCommentID = c.ContentCommentID; this.CreateDate = c.CreateDate; } }