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

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

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

            // assert
            Assert.True(statusMessage.IsCompleted);
        }
コード例 #2
0
        public async Task <IActionResult> DeleteSingleItem(string key)
        {
            int id            = Int32.Parse(key);
            var statusMessage = await logicValidation.CheckRemoveDataModelAsync(id);

            if (statusMessage.IsCompleted)
            {
                await logic.RemoveDataModelAsync(id);

                await logProvider.AddToLogAsync($"Removed transaction (Id: {key}).");

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