private static VehicleInfo GetRandomVehicleInfoOverride(ref Randomizer r, ItemClass.Service service, ItemClass.SubService subService, ItemClass.Level level, IList <string> array) { return(VehicleProvider.GetVehicleInfo(ref r, service, subService, level, array[r.Int32((uint)array.Count)])); }
// GET public IActionResult ViewVehicles() { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } ViewData["Vehicles"] = VehicleProvider.getAllVehicles(); return(View("View")); }
public IActionResult AddWithVehicle(string vrm) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } ViewData["Vehicle"] = VehicleProvider.getVehicleFromVRM(vrm); return(View("AddCustomerWithVehicle")); }
public IActionResult Search(string search) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } ViewData["Vehicles"] = VehicleProvider.searchVehicles(search); ViewData["Search"] = search; return(View("View")); }
public IActionResult BookVehicle(string type, string issue, string cosmetic, string resolution, string labour, string bay, string customerID, string vrm, string mechanic) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } JobNote estimate = new JobNote { id = JobProvider.GetUniqueKey(255), type = "Estimate", body = "Issue: " + issue + " Cosmetic Condition: " + cosmetic + " Proposed Resolution: " + resolution, time = DateTime.Now, user = UserProvider.getUserFromUsername(HttpContext.Session.GetString("user")) }; JobNote labourEstimate = new JobNote { id = JobProvider.GetUniqueKey(255), type = "Labour Estimate", body = labour, time = DateTime.Now, user = UserProvider.getUserFromUsername(HttpContext.Session.GetString("user")) }; List <JobNote> notes = new List <JobNote>(); notes.Add(estimate); notes.Add(labourEstimate); Job job = new Job { jobID = JobProvider.GetUniqueNumber(8), start = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day), end = null, paid = null, bay = Int32.Parse(bay), status = "Ongoing", type = type, customer = CustomerProvider.getCustomerFromID(customerID), vehicle = VehicleProvider.getVehicleFromVRM(vrm), notes = notes, labour = new Dictionary <string, float>(), mechanic = UserProvider.getUserFromUsername(mechanic) }; JobProvider.createJob(job); TempData["JobID"] = job.jobID; return(RedirectToAction("ViewJob", new { id = job.jobID })); }
public IActionResult AddVehicleSearch(string vrm, string search) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } ViewData["Customers"] = CustomerProvider.searchCustomers(search); ViewData["Search"] = search; ViewData["Vehicle"] = VehicleProvider.getVehicleFromVRM(vrm); return(View("AddVehicleSearchCustomer")); }
public async Task <bool> CreateVehicleProvider(VehicleProviderServiceModel vehicleProviderServiceModel) { if (_context.VehicleProviders.Any(v => v.Name == vehicleProviderServiceModel.Name)) { return(false); } VehicleProvider provider = AutoMapper.Mapper.Map <VehicleProvider>(vehicleProviderServiceModel); _context.VehicleProviders.Add(provider); var result = await _context.SaveChangesAsync(); return(result > 0); }
public IActionResult Car(string vrm) { vrm = vrm.Replace(" ", ""); ViewData["Car"] = VehicleProvider.getVehicleFromVRM(vrm); try { ViewData["DVLACar"] = VehicleProvider.getDVLADetails(vrm); } catch { ViewData["DVLACar"] = new DVLAData(); } ViewData["vrm"] = vrm; return(View()); }
public IActionResult ViewVehiclesJobs(string vrm) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } ViewData["Vehicle"] = VehicleProvider.getVehicleFromVRM(vrm); List <Job> jobs = new List <Job>(); foreach (string jobID in JobProvider.getPreviousJobs(vrm, "")) { jobs.Add(JobProvider.getJobDetails(jobID)); } ViewData["Jobs"] = jobs; return(View("ViewJobs")); }
public IActionResult UpdateVehicle(string vrm, string make, string model, string year, string colour, string serial, string chassis) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } Vehicle vehicle = VehicleProvider.getVehicleFromVRM(vrm); vehicle.vrm = vrm; vehicle.make = make; vehicle.model = model; vehicle.year = year; vehicle.colour = colour; vehicle.engine = serial; vehicle.chassis = chassis; VehicleProvider.updateVehicle(vehicle); return(RedirectToAction("Search", new { search = vrm })); }
public IActionResult RegisterVehicle(string vrm, string make, string model, string year, string colour, string serial, string chassis) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } Vehicle vehicle = new Vehicle { vrm = vrm, make = make, model = model, year = year, chassis = chassis, colour = colour, engine = serial }; VehicleProvider.addVehicle(vehicle); return(RedirectToAction("AddWithVehicle", "Customer", new { vrm = vrm })); }
public IActionResult AddVehicle(string vrm) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } vrm = vrm.Replace(" ", ""); try { ViewData["DVLADetails"] = VehicleProvider.getDVLADetails(vrm); } catch { ViewData["DVLADetails"] = new DVLAData(); } ViewData["vrm"] = vrm; return(View()); }
public IActionResult BookAddVehicle(string vrm) { if (!isAuthenticated()) { return(RedirectToAction("Login", "Auth")); } Vehicle vehicle = VehicleProvider.getVehicleFromVRM(vrm); if (vehicle.vrm == null) { return(RedirectToAction("AddVehicle", "Vehicle", new { vrm = vrm })); } ViewData["Vehicle"] = vehicle; Customer customer = VehicleProvider.getCustomerFromVehicle(vrm); ViewData["Customer"] = customer; ViewData["Debt"] = CustomerProvider.checkIfInDebt(customer.customerID); ViewData["Mechanic"] = UserProvider.getUsers(); return(View("Book")); }