Esempio n. 1
0
        public async void RemoveFacility_FromInitializedDbTable_RemovedFacilityNotFoundInDb()
        {
            // arrange
            var facility = GetFacility();

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

            // act
            await logic.RemoveDataModelAsync(facility.Id);

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

            Assert.Null(actual);
        }
Esempio n. 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 facility (Id: {key}).");

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