Beispiel #1
0
        public async void RemoveStorag_FromInitializedDbTable_RemovedStoragNotFoundInDb()
        {
            // arrange
            var storage = GetStorage();

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

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

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

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

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