public virtual void DeleteList(string listId) { var context = new TaskDataContext(); var list = context.TaskLists .Where(t => t.RowKey == listId && t.PartitionKey == listId.Substring(0, 1) && true) .SingleOrDefault(); if (list != null) { var tasks = context.Tasks .Where(t => t.PartitionKey == listId); foreach (TaskRow task in tasks) { context.DeleteObject(task); } context.DeleteObject(list); context.SaveChanges(); } }
public virtual void DeleteTask(string listId, string taskId) { var context = new TaskDataContext(); var task = context.Tasks .Where(t => t.PartitionKey == listId && t.RowKey == taskId && true) .SingleOrDefault(); if (task != null) { context.DeleteObject(task); context.SaveChanges(); } }