Beispiel #1
0
        public async void CheckRemoveCompany_FromInitializedDbTable_ErrorHandlerIsCompletedTrue()
        {
            // arrange
            var company = GetCompany();

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

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

            // assert
            Assert.True(statusMessage.IsCompleted);
        }
Beispiel #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 company (Id: {key}).");

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