public async Task <IActionResult> GetEditSingleItem(string key) { // add distincted from edit, by presence of key parameter // further on they distincted by ViewData[SaveRoute] if (key != null) { int id = Int32.Parse(key); ViewData["SaveRoute"] = LicensesRouting.EditSingleItem; var statusMessage = await logicValidation.CheckGetSingleUpdateModelAsync(id); if (statusMessage.IsCompleted) { var model = await logic.GetSingleUpdateModelAsync(id); return(View("EditSingleItem", model)); } else { return(View("CustomError", statusMessage)); } } else { ViewData["SaveRoute"] = LicensesRouting.AddSingleItem; return(View("EditSingleItem")); } }
public async void GetLicense_FromInitializedDbTable_LogicLicenseEqualExpectedLicense() { // arrange var expected = GetLicense(); fixture.db.License.Add(expected); await fixture.db.SaveChangesAsync(); // act var actual = await logic.GetSingleUpdateModelAsync(expected.Id); // assert Assert.Equal(actual.Id, expected.Id); Assert.Equal(actual.Date, expected.Date); Assert.Equal(actual.GovermentNum, expected.GovermentNum); Assert.Equal(actual.ProductId, expected.ProductId); }