예제 #1
0
        public async Task CalculateTotalPurchasePriceTest()
        {
            var car = CarDataSeeder.GetEntities().First();
            await _carRepository.AddAsync(car);

            var carModel = (await _carModelService.GetCarModelsAsync()).Last();

            Assert.Equal(1100, _carModelService.CalculateTotalPurchasePrice(carModel));
        }
예제 #2
0
        public async Task <IActionResult> AddCar(CarModel carModel)
        {
            if (carModel.SellingPrice <= _carModelService.CalculateTotalPurchasePrice(carModel))
            {
                ModelState.AddModelError("", "Car Price is smaller than Purchase Price and Repair costs (must be bigger when adding a new car)!");
                return(View(carModel));
            }

            return(await SaveCar(carModel, "Overview"));
        }