/// <summary> /// Deletes this instance. /// </summary> public virtual void delete() { DeleteEventArgs e = new DeleteEventArgs(); FireBeforeDelete(e); if (!e.Cancel) { // remove relations var rels = Relations; foreach (relation.Relation rel in rels) { rel.Delete(); } //removes tasks foreach (Task t in Tasks) { t.Delete(); } //remove notifications Notification.DeleteNotifications(this); //remove permissions Permission.DeletePermissions(this); //removes tag associations (i know the key is set to cascade but do it anyways) Tag.RemoveTagsFromNode(this.Id); Database.Delete <NodeDto>("WHERE uniqueID=@uniqueId", new { uniqueId = _uniqueID }); FireAfterDelete(e); } }
/// <summary> /// /// </summary> /// <param name="identityId"></param> public static void DeleteAuthToken(int identityId) { //Just to be 100% sure for data sanity that a record for the user does not exist already var existingRecord = GetAuthToken(identityId); if (existingRecord != null) { //We found the record in the DB - let's remove/delete it Database.Delete <UmbracoAuthToken>("WHERE IdentityId=@0", identityId); } }
public void Delete() { var dataTypeDefinition = DataTypeService.GetAllDataTypeDefinitions().FirstOrDefault(x => x.Name == DataTypeDefinition.Name); if (dataTypeDefinition == null) { throw new FluentException(string.Format("The Data Type Definition `{0}` does not exist.", DataTypeDefinition.Name)); } UmbracoDatabase.Delete <DataTypePreValueDto>("WHERE datatypeNodeId = @NodeId", new { NodeId = DataTypeDefinition.Id }); DataTypeService.Delete(dataTypeDefinition); }
/// <summary> /// Creates the Configuration table /// </summary> public override void Up() { // Environment if (_schemaHelper.TableExist <Dto.Environment.Environment100>()) { var sql = new Sql().Where("id != 1"); _database.Delete <Dto.Environment.Environment100>(sql); Alter.Table <Dto.Environment.Environment103>().AddColumn(nameof(Dto.Environment.Environment103.SortOrder)).AsInt32().NotNullable().WithDefaultValue(Constants.Tree.DefaultEnvironmentSortOrder); Alter.Table <Dto.Environment.Environment103>().AddColumn(nameof(Dto.Environment.Environment103.Enable)).AsBoolean().NotNullable().WithDefaultValue(true); Alter.Table <Dto.Environment.Environment103>().AddColumn(nameof(Dto.Environment.Environment103.ContinueProcessing)).AsBoolean().NotNullable().WithDefaultValue(true); Alter.Table <Dto.Environment.Environment103>().AddColumn(nameof(Dto.Environment.Environment103.ColorIndicator)).AsString(7).NotNullable().WithDefaultValue("#df7f48"); } else { _schemaHelper.CreateTable <Dto.Environment.Environment103>(); _database.Insert(new Dto.Environment.Environment103 { Name = "Default", Icon = "icon-firewall red", Enable = true, ContinueProcessing = true, SortOrder = Constants.Tree.DefaultEnvironmentSortOrder, ColorIndicator = "#df7f48" }); } // Domain if (!_schemaHelper.TableExist <Dto.Domain.Domain100>()) { _schemaHelper.CreateTable <Dto.Domain.Domain100>(); } // Configuration if (!_schemaHelper.TableExist <Dto.Configuration.Configuration100>()) { _schemaHelper.CreateTable <Dto.Configuration.Configuration103>(); } // Journal if (_schemaHelper.TableExist <Dto.Journal.Journal100>()) { Delete.Index("IX_" + nameof(Shield) + "_" + nameof(Dto.Journal.Journal100.Datestamp)).OnTable <Dto.Journal.Journal100>(); Create.Index("IX_" + nameof(Shield) + "_" + nameof(Dto.Journal.Journal103.Datestamp)).OnTable <Dto.Journal.Journal103>() .OnColumn(nameof(Dto.Journal.Journal103.Datestamp)).Ascending().WithOptions().NonClustered(); } else { _schemaHelper.CreateTable <Dto.Journal.Journal103>(); } }
public System.Web.Http.IHttpActionResult DeleteGame(int id) { UmbracoDatabase db = ApplicationContext.DatabaseContext.Database; try { db.Delete <Game>(id); } catch (System.Exception exception) { return(Content(System.Net.HttpStatusCode.BadRequest, exception)); } return(Ok()); }
public async Task <ActionResult> DeleteConfirmed(long id) { var query = new Sql().Select("*").From(TABLE_NAME).Where <PropertyViewModel>(x => x.PropertyId == id, DatabaseContext.SqlSyntax); PropertyViewModel propertyModel = await Task.FromResult((PropertyViewModel)db.Fetch <PropertyViewModel>(query).FirstOrDefault()); await Task.FromResult(db.Delete(propertyModel)); TempData["RecordDeleted"] = true; return(RedirectToCurrentUmbracoPage()); //return RedirectToAction("Index"); }
public IHttpActionResult DeleteCategoryModel(long id) { var query = new Sql().Select("*").From(TABLE_NAME).Where <CategoryModel>(x => x.CategoryId == id, DatabaseContext.SqlSyntax); CategoryModel categoryModel = (CategoryModel)db.Fetch <CategoryModel>(query).FirstOrDefault(); if (categoryModel == null) { return(NotFound()); } db.Delete(categoryModel); return(Ok(categoryModel)); }
public void DeleteOperation(LatchOperation operation) { using (var scope = db.GetTransaction()) { if (!operation.ApplyToAllUsers) { var deleteUsersQuery = Sql.Builder .Append("DELETE FROM LatchOperationUser") .Where("LatchOperationId = @0", operation.Id); db.Execute(deleteUsersQuery); } if (!operation.ApplyToAllNodes) { var deleteNodesQuery = Sql.Builder .Append("DELETE FROM LatchOperationNode") .Where("LatchOperationId = @0", operation.Id); db.Execute(deleteNodesQuery); } db.Delete(operation); scope.Complete(); } }
public void DeleteUser(int id) { var query = new Sql().Where <EasyADGroup2User>(e => e.UserId == id); _database.Delete <EasyADGroup2User>(query); }
public void Delete(int productId) { db.Delete <Product>(productId); }
public IDataType DeleteAllPreValues() { UmbracoDatabase.Delete <DataTypePreValueDto>("WHERE datatypeNodeId = @NodeId", new { NodeId = DataTypeDefinition.Id }); return(this); }
public virtual void Delete(T dbEntity) { Database.Delete(dbEntity); }
public bool Delete(TEntityType entity) { return(_database.Delete(entity) > 0); }
public void Delete(GroupMember member) { _db.Delete(member); }
public void Delete(StructuralGroup group) { _db.Delete(group); }