Carrotware.CMS.Core.ContentCategory.Delete C# (CSharp) Method

Delete() public method

public Delete ( ) : void
return void
        public void Delete()
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
                carrot_ContentCategory s = CompiledQueries.cqGetContentCategoryByID(_db, this.ContentCategoryID);

                if (s != null) {
                    IQueryable<carrot_CategoryContentMapping> lst = (from m in _db.carrot_CategoryContentMappings
                                                                     where m.ContentCategoryID == s.ContentCategoryID
                                                                     select m);

                    _db.carrot_CategoryContentMappings.BatchDelete(lst);
                    _db.carrot_ContentCategories.DeleteOnSubmit(s);
                    _db.SubmitChanges();
                }
            }
        }