public async Task GetEditModelAsync_WithManufacturerId_ShouldReturnValidServiceModel() { // Arrange FitStoreDbContext database = this.Database; DatabaseHelper.SeedData(database); IManagerManufacturerService managerManufacturerService = new ManagerManufacturerService(database); // Act ManufacturerBasicServiceModel result = await managerManufacturerService.GetEditModelAsync(firstNotDeletedManufacturerId); // Assert result.Id.Should().Be(firstNotDeletedManufacturerId); result.Name.Should().Be(firstNotDeletedManufacturerName); }
public async Task <IActionResult> Edit(int id) { bool isManufacturerExistingById = await this.manufacturerService.IsManufacturerExistingById(id, false); if (!isManufacturerExistingById) { TempData.AddErrorMessage(string.Format(EntityNotFound, ManufacturerEntity)); return(this.RedirectToManufacturersIndex(false)); } ManufacturerBasicServiceModel manufacturer = await this.managerManufacturerService.GetEditModelAsync(id); ManufacturerFormViewModel model = Mapper.Map <ManufacturerFormViewModel>(manufacturer); return(View(model)); }