public async Task <bool> CompleteCarpoolOfferDriverSide(CarpoolOfferFulfillment fulfillment) { fulfillment.DriverHasCompleted = true; fulfillment.DriverCompletedDateTime = DateTime.Now; fulfillment.IsFarePaid = true; var uri = new Uri(string.Format(AppServerConstants.CarpoolOfferFulfillmentsUrl, fulfillment.CarpoolOfferFulfillmentId)); HttpResponseMessage responseMessage = null; try { var json = JsonConvert.SerializeObject(fulfillment); var content = new StringContent(json, Encoding.UTF8, "application/json"); responseMessage = await client.PutAsync(uri, content); if (responseMessage.IsSuccessStatusCode) { Debug.WriteLine("POST 201 OK: Carpool fulfillment successfully completed (driver)"); return(true); } else { Debug.WriteLine(@"POST {0} NOT OK: Carpool request fulfillment failed", responseMessage.StatusCode); } } catch (Exception ex) { Debug.WriteLine(@"ERROR: {0}", ex.Message); } return(false); }
public CPCompletedPage(CarpoolOfferFulfillment carpoolOfferFulfillment) { InitializeComponent(); CPFulfillment = carpoolOfferFulfillment; BindingContext = CPFulfillment.CarpoolOffer; }
public CPFulfillmentPage(CarpoolOfferFulfillment fulfillment) { InitializeComponent(); selectedCPFulfillment = fulfillment; BindingContext = fulfillment.CarpoolOffer; FullName.Text = string.Format("{0} {1}", fulfillment.CarpoolOffer.Driver.FirstName, fulfillment.CarpoolOffer.Driver.LastName); }
public async Task <IActionResult> PostCarpoolOfferFulfillment([FromBody] CarpoolOfferFulfillment carpoolOfferFulfillment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CarpoolOfferFulfillments.Add(carpoolOfferFulfillment); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCarpoolOfferFulfillment", new { id = carpoolOfferFulfillment.CarpoolOfferFulfillmentId }, carpoolOfferFulfillment)); }
public async Task <IActionResult> PutCarpoolOfferFulfillment([FromRoute] int id, [FromBody] CarpoolOfferFulfillment carpoolOfferFulfillment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != carpoolOfferFulfillment.CarpoolOfferFulfillmentId) { return(BadRequest()); } _context.Entry(carpoolOfferFulfillment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarpoolOfferFulfillmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Task <bool> CompleteCarpoolOfferPassengerSide(CarpoolOfferFulfillment fulfillment) { return(carpoolService.CompleteCarpoolOfferPassengerSide(fulfillment)); }