Deleting a block item
This script deletes a block's item from a task from if the corresponding field is not filled in:
foreach (var item in context.Blok.ToList()) //for each block item
{
if (item.Equipment== null) //if the Equipment field is not filled in
context.Blok.Remove(item); //then this block item is deleted
}
To completely delete a block, use these script:
foreach (var item in context.Block.ToList())
{
context.Block.Remove(item);
item.Delete();
}