Esempio n. 1
0
        public async Task <IActionResult> AddSingleItem(License model)
        {
            var license = await logic.AddDataModelAsync(model);

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

            return(RedirectToRoute(LicensesRouting.Index));
        }
Esempio n. 2
0
        public async void AddLicense_ToEmptyDbTable_AddedLicenseEqualExpectedLicense()
        {
            // arrange
            var expected = GetLicense();

            // act
            await logic.AddDataModelAsync(expected);

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

            Assert.Equal(expected.Id, actual.Id);
            Assert.Equal(expected.ProductId, actual.ProductId);
            Assert.Equal(expected.Date, actual.Date);
            Assert.Equal(expected.GovermentNum, actual.GovermentNum);
        }
Esempio n. 3
0
        public async Task <IActionResult> AddSingleItem(License model)
        {
            var statusMessage = await logicValidation.CheckAddDataModelAsync(model);

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

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

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