public ActionResult <string> EndRide(Ride ride) { var cabService = new CabService(); var estimatedFare = cabService.EndRide(ride); return(Ok(estimatedFare)); }
public string RegisterCabService([FromBody] CabService cab) { using (thanujaEntities entities = new thanujaEntities()) { entities.CabServices.Add(cab); entities.SaveChanges(); } return("successful"); }
public ActionResult EndRide(Cab cab, Customer customer) { CabService cabService = new CabService(); cabService.UpdateCabLocation(cab, customer); CustomerService customerService = new CustomerService(); customerService.RemoveCustomer(customer); return(Ok()); }
public MainView() { InitializeComponent(); // initialise rest of control leftCardOptions.Visibility = Visibility.Hidden; rightCardOptions.Visibility = Visibility.Hidden; ListParsingService = new LocalListParsingService(); CabService = new CabService(); SetUpDataGrids(); this.LayoutUpdated += MainView_LayoutUpdated; SetUpSharePointDataService(false); }
public ActionResult <Ride> BookARide(Customer customer) { try { var cabService = new CabService(); var identifiedCab = cabService.AssignClosestAvailableCab(customer); return(Ok(identifiedCab)); } catch (CabNotFoundException) { return(BadRequest()); } }
public void checkForWrongTimeInput() { try { //check for single cap services CabService service = new CabService(10, 0, 0, "suraj"); //total pay for single ride int totalpay = service.getTotalFair(); } catch (cabInoviceException e) { Assert.AreEqual("enter proper time", e.Message); } }
public void TestForTotalFairForPremiumRide() { try { //check for single cap services CabService service = new CabService(10, 15, 1, "suraj"); //total pay for single ride int totalpay = service.getTotalFair(); //if equel the pass Assert.AreEqual(180, totalpay); } catch (cabInoviceException e) { Assert.AreEqual("enter proper time", e.Message); } }
public ActionResult <Cab> BookARide(Customer customer) { try { CustomerService customerService = new CustomerService(); var registeredCustomer = customerService.RegisterCustomer(customer); CabService cabService = new CabService(); var identifiedCab = cabService.AssignClosestAvailableCab(registeredCustomer); return(Ok(identifiedCab)); } catch (CabNotFoundException) { return(BadRequest()); } }
private void OpenParseStoreList(ObservableCollection <SharePointListStructure> list) { // Create OpenFileDialog OpenFileDialog dlg = new OpenFileDialog { Multiselect = true }; // folder path string folderpath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + "\\SPTFiles\\"; // Set filter for file extension and default file extension dlg.DefaultExt = ".stp"; dlg.Filter = "SP Template (*.stp)|*.stp|Cab Files (*.cab)|*.cab|All files (*.*)|*.*"; // Display OpenFileDialog by calling ShowDialog method bool?result = dlg.ShowDialog(); Task.Run(() => { // Get the selected file name and display in a TextBox if (result == true) { // ensure our save directory exists already if (!Directory.Exists(folderpath)) { Directory.CreateDirectory(folderpath); } //Failed items List <SharePointListStructure> failedImports = new List <SharePointListStructure>(); foreach (string fp in dlg.FileNames) { // Open document string name = Path.GetFileName(fp); string filePath = fp; // get and check document extension string ext = Path.GetExtension(fp); if (ext.ToLower() == ".spt") { name = Guid.NewGuid().ToString(); filePath = folderpath + Path.GetFileName(filePath + ".cab"); File.Copy(filePath, filePath, true); } // create extract directory for the manifest file var extractDir = string.Format("{0}{1}", folderpath, name); if (!Directory.Exists(extractDir)) { Directory.CreateDirectory(extractDir); } var extractedFilePath = CabService.ExtractFromCabFile(filePath, extractDir); var parsedFile = ListParsingService.ParseSPTFile(extractedFilePath); if (parsedFile != null && parsedFile?.ColumnDefinitions != null) { Dispatcher.Invoke(() => { list.Add(parsedFile); }); } else { Dispatcher.Invoke(() => { // make a note of our failed lists. failedImports.Add(parsedFile); }); } } if (failedImports.Count > 0) { // Show which lists failed to Import. StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("Failed List Imports:").AppendLine().AppendLine(); foreach (var structure in failedImports) { string line = string.Format("List name: {0}", structure.ListName); stringBuilder.Append(line).AppendLine().AppendLine().Append("----").AppendLine().AppendLine(); } Dispatcher.Invoke(() => { RootWindow.DialogOverlayControl.SetDialogText(stringBuilder.ToString()); RootWindow.DialogOverlayControl.ToggleOverlay(); }); } } }); }
public CabsController(TripService tripService, CabService cabService) { _tripService = tripService; _cabService = cabService; }