コード例 #1
0
ファイル: OperationsTests.cs プロジェクト: No0zZy/Cursed
        public async void RemoveOperation_FromInitializedDbTable_RemovedOperationNotFoundInDb()
        {
            // arrange
            var operation = GetOperation();

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

            // act
            await logic.RemoveDataModelAsync(operation);

            // assert
            var actual = await fixture.db.Operation.FirstOrDefaultAsync(i => i.Id == operation.Id);

            Assert.Null(actual);
        }
コード例 #2
0
ファイル: OperationsController.cs プロジェクト: No0zZy/Cursed
        public async Task <IActionResult> DeleteSingleItem(Operation model)
        {
            var statusMessage = await logicValidation.CheckRemoveDataModelAsync(model.Id);

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

                await logProvider.AddToLogAsync($"Removed operation (Id: {model.Id}).");

                return(RedirectToRoute(TransactionsRouting.SingleItem, new { key = model.TransactionId }));
            }
            else
            {
                return(View("CustomError", statusMessage));
            }
        }