public async Task <string> GetJourneys(JourneyModel model) { var authToken = Request.Headers["auth-token"]; var session = authToken.Split(','); var bodyParam = new RequestBase <Journeys>() { Data = new Journeys() { Date = Convert.ToDateTime(model.Date), DestinationId = model.DestinationId, OriginId = model.OriginId }, DeviceSession = new DeviceSession { DeviceId = session[1], SessionId = session[0] } }; var stringContent = new StringContent(JsonConvert.SerializeObject(bodyParam, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }), Encoding.UTF8, "application/json"); var response = await Client.Instance.PostAsync("/api/journey/getbusjourneys", stringContent); if (response.StatusCode != HttpStatusCode.OK) { throw new HttpUnhandledException(); } var responseString = response.Content.ReadAsStringAsync().Result; var responseData = JsonConvert.DeserializeObject <ResponseBase <object> >(responseString); return(JsonConvert.SerializeObject(new { responseData.Data })); }
public IActionResult Validate(JourneyModel model) { try { var config = new MapperConfiguration(cfg => { cfg.CreateMap <JourneyModel, Journey>(); }); IMapper iMapper = config.CreateMapper(); var journey = iMapper.Map <JourneyModel, Journey>(model); journey.UserId = Guid.Parse(User.Identity.Name); var result = _journeyService.ValidateJourney(journey); return(Ok(result)); } catch (Exception ex) { ex.LogException(); return(Ok(new ServiceResponse { Status = DAL.Common.Enums.ResponseStatus.ServerError })); } }
//Find a single journey details. public SingleJourney getJourney(Journey theJourney) { SingleJourney result = new SingleJourney(); JourneyModel thisjourney = new JourneyModel(); thisjourney.ECoordLat = theJourney.ECoordLat; thisjourney.ECoordLog = theJourney.ECoordLog; thisjourney.EndTime = theJourney.EndTime; thisjourney.Journeyid = theJourney.JourneyId; thisjourney.NavigateRoute = theJourney.NavigateRoute; thisjourney.SCoordLat = theJourney.SCoordLat; thisjourney.SCoordLog = theJourney.SCoordLog; thisjourney.StartTime = theJourney.StartTime; thisjourney.Status = theJourney.Status; thisjourney.UserProfileId = theJourney.UserProfileId; result.journeyDetails = thisjourney; List <JTracking> theTrack = db.JTracking.Where(s => s.JourneyJourneyId == theJourney.JourneyId).ToList(); foreach (JTracking t in theTrack) { JTrackModel thisTrack = new JTrackModel(); thisTrack.CoordLat = t.CoordLat; thisTrack.CoordLog = t.CoordLog; thisTrack.JourneyJourneyId = t.JourneyJourneyId; thisTrack.Time = t.Time; result.trackDetails.Add(thisTrack); } //result.trackDetails = db.JTracking.Where(s => s.JourneyJourneyId == theJourney.JourneyId).ToList(); return(result); }
public IHttpActionResult GetJourneyModel(int id) { JourneyModel journeyModel = db.JourneyModels.Find(id); if (journeyModel == null) { return(NotFound()); } return(Ok(journeyModel)); }
public override void PopulateData(object data) { currentData = (JourneyModel)data; List <tblCustomer> customers = customerService.GetCustomers(); dsCustomer.DataSource = customers; this.txtJourney.Text = currentData.Journey; this.txtBase.Text = currentData.Base.ToString(); this.txtCustomer.EditValue = currentData.CustomerId; }
private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e) { JourneyModel selectedJourney = (JourneyModel)e.Row; selectedJourney = journeys.FirstOrDefault(j => j.Journey == selectedJourney.Journey); JourneyModel dsJourney = addedJourneys.FirstOrDefault(j => j.Journey == selectedJourney.Journey); dsJourney.ID = selectedJourney.ID; dsJourney.Base = selectedJourney.Base; dsJourney.Gen_Journey = selectedJourney.Gen_Journey; }