public bool DeleteAppData(string personId, HashSet<string> keys, string appId) { using (var db = new AzureRayaDataContext()) { if (keys.Count == 0) { var ret = db.applicationSettings .Where(x => x.application_id == appId && x.PartitionKey == personId); db.DeleteAllOnSubmit(ret); } else { foreach (var key in keys) { var ret = db.applicationSettings .Where(x => x.application_id == appId && x.PartitionKey == personId && x.name == key); db.DeleteOnSubmit(ret); } } db.SubmitChanges(); } return true; }
public bool DeleteActivities(string userId, string appId, HashSet<string> activityIds) { var activityList = new List<ActivityRow>(); using (var db = new AzureRayaDataContext()) { foreach (var id in activityIds) { var res = db.activities .Where(x => x.id == id && x.PartitionKey == userId && x.app_id == appId).SingleOrDefault(); if (res != null) { activityList.Add(res); } } db.DeleteAllOnSubmit(activityList.AsQueryable()); db.SubmitChanges(); } return true; }