Example #1
0
        public async Task <IActionResult> AddSingleItem(Storage model)
        {
            var storage = await logic.AddDataModelAsync(model);

            await logProvider.AddToLogAsync($"Added new storage (Id: {storage.Id}).");

            return(RedirectToRoute(StoragesRouting.Index));
        }
Example #2
0
        public async void AddStorage_ToEmptyDbTable_AddedStorageEqualExpectedStorage()
        {
            // arrange
            var expected = GetStorage();

            // act
            await logic.AddDataModelAsync(expected);

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

            Assert.Equal(expected.Id, actual.Id);
            Assert.Equal(expected.Name, actual.Name);
            Assert.Equal(expected.Latitude, actual.Latitude);
            Assert.Equal(expected.Longitude, actual.Longitude);
            Assert.Equal(expected.CompanyId, actual.CompanyId);
        }
Example #3
0
        public async Task <IActionResult> AddSingleItem(Storage model)
        {
            var statusMessage = await logicValidation.CheckAddDataModelAsync(model);

            if (statusMessage.IsCompleted)
            {
                var storage = await logic.AddDataModelAsync(model);

                await logProvider.AddToLogAsync($"Added new storage (Id: {storage.Id}).");

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