コード例 #1
0
ファイル: NoteModel.cs プロジェクト: codyborn/notegami
        /// <summary>
        /// Deletes the note and cleans up the transactions
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="noteId"></param>
        public static bool DeleteNote(string userId, string noteId)
        {
            IEnumerable <TransactionModel> transactions = TransactionModel.GetTagsByNoteId(userId, noteId);
            //Task<bool>[] deleteRequests = new Task<bool>[transactions.Count() + 1];
            //int writeIndex = 0;
            bool success = true;

            foreach (TransactionModel tranny in transactions)
            {
                success &= CosmosDBClient.Delete(tranny.Id, userId);
            }
            success &= CosmosDBClient.Delete(noteId, userId);
            return(success);
            // Wait for all to complete and combine results
            //bool[] results = Task.WhenAll(deleteRequests.ToArray()).Result;
            //return results.Aggregate((workingBool, currBool) => workingBool && currBool);
        }
コード例 #2
0
ファイル: TransactionModel.cs プロジェクト: codyborn/notegami
 public static bool RemoveTransaction(string userId, string noteId, string tag)
 {
     return(CosmosDBClient.Delete(GetId(tag, noteId), userId));
 }