コード例 #1
0
        public async void CheckAddTransaction_FromBadInitializedDbTable_ErrorHandlerIsCompletedFalse()
        {
            // arrange
            var transaction = GetTransaction();

            fixture.db.Add(transaction);
            await fixture.db.SaveChangesAsync();

            // act
            var statusMessage = await logicValidation.CheckAddDataModelAsync(transaction);

            // assert
            Assert.False(statusMessage.IsCompleted);
        }
コード例 #2
0
        public async Task <IActionResult> AddSingleItem(TransactionBatch model)
        {
            var statusMessage = await logicValidation.CheckAddDataModelAsync(model);

            if (statusMessage.IsCompleted)
            {
                var transaction = await logic.AddDataModelAsync(model);

                await logProvider.AddToLogAsync($"Added new transaction (Id: {transaction.Id}).");

                return(RedirectToRoute(TransactionsRouting.Index));
            }
            else
            {
                return(View("CustomError", statusMessage));
            }
        }