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)); }
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); }
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)); } }