public IActionResult Finalize(SaleReviewFormModel model) { if (!ModelState.IsValid) { return(View(nameof(Review), model)); } this.saleService.Create(model.CustomerId, model.CarId, model.Discount); return(RedirectToAction(nameof(All))); }
public IActionResult Review(SaleFormModel saleModel) { CustomerBasicServiceModel customerModel = this.customerService.GetBasicCustomerById(saleModel.CustomerId); CarBasicServiceModel carModel = this.carService.GetBasicCarById(saleModel.CarId); SaleReviewFormModel model = new SaleReviewFormModel { CustomerId = customerModel.Id, CustomerName = customerModel.Name, IsYoungDriver = customerModel.IsYoungDriver, CarId = carModel.Id, CarMake = $"{carModel.Make} {carModel.Model}", Discount = saleModel.Discount, CarPrice = this.saleService.GetCarPrice(carModel.Id), FinalCarPrice = this.saleService.GetCarPriceWithDiscount(carModel.Id, saleModel.Discount, customerModel.IsYoungDriver) }; return(View(model)); }