public ActionResult ShowOptions(int id) { var carModel = CarModelFactory.GetCarModel(Repository.FindCar(id)); List <string> options = null; if (carModel != null) { IGenerateOptionsMacro macro = GenerateOptionsMacroFactory.CreateOptionsMacro(carModel); options = macro.GenerateOptions(carModel); } return(Json(options, JsonRequestBehavior.AllowGet)); }
public string RequestAQuote(string serviceType, string model) { double quotePrice = 0; string vehicleType = string.Empty; ClassifyModel objClassifyModel = new ClassifyModel(); CarModelFactory objCarModelFactory = new CarModelFactory(); try { // The below call to the Other company service will return the type of the car based on the model vehicleType = objClassifyModel.GetCarType(model); if ( vehicleType != string.Empty) { CarModel objCarModel = objCarModelFactory.GetCarModel(vehicleType); ServiceTypeFactory objServiceTypeFactory = new ServiceTypeFactory(); ServiceType objServiceType = objServiceTypeFactory.GetServiceType(serviceType); // Followiing code will set the Listed price of the service for the respective model objServiceType.getListedPrice(objCarModel); // Following code will return the discounted price if applicable defined in the abstract service type class quotePrice = objServiceType.getDiscountedPrice(objCarModel); } else { new ServiceUnAvailableException(); } } catch(Exception ex) { throw ex; } return "£" + string.Format("{0:N2}", quotePrice) ; }
// // GET: /Car/Details/5 public ActionResult Details(int id) { var carModel = CarModelFactory.GetCarModel(Repository.FindCar(id)); return(View("Details", carModel)); }