public ActionResult CreateTripFromTemplate(int templateId) { // get the trip template BlTripTemplate _template = null; var _blerror = TripManager.GetTripTemplatesById(templateId, out _template); // assign the template to the view model var _model = new TripViewModel(); _model.CreateTripTemplate = _template; var startLocationOptions = _template.DlTemplate.StartLocation.Split('/').ToList(); var _tripStartLocationOptions = new List <SelectListItem>(); foreach (var startLocation in startLocationOptions) { _tripStartLocationOptions.Add(new SelectListItem() { Text = startLocation, Value = startLocation }); } _model.CreateTripStartLocationOptions = _tripStartLocationOptions; _model.CreateTripViewModel = new CreateTripViewModel() { DestinationId = _template.DlTemplate.DestinationId, TemplateId = _template.DlTemplate.Id, StartDate = DateTime.Now }; return(View("Trip", _model)); }
public ActionResult AddCircuitToTrip(int tripId, int templateId = 0) { BlViewTrip trip = null; var _blError = TripManager.GetTripById(tripId, out trip); if (_blError.ErrorCode != 0) { throw new ApplicationException(_blError.ErrorMessage); } var model = new TripViewModel(); model.ActiveTrip = trip; BlTripTemplate template = null; _blError = TripManager.GetTripTemplatesById(templateId, out template); if (_blError.ErrorCode != 0) { throw new ApplicationException(_blError.ErrorMessage); } model.CreateTripTemplate = template; return(View(model)); }
public ActionResult ViewTripTemplate(int TemplateId) { BlTripTemplate _template = null; var _blError = TripManager.GetTripTemplatesById(TemplateId, out _template); if (_blError.ErrorCode != 0) { throw new ApplicationException(_blError.ErrorMessage); } var _model = new ViewTripTemplateViewModel() { TripTemplate = _template }; var _trip = TripManager.GetImmediateTripForUser(User.Identity.GetUserId()); if (_trip != null) { _model.TripId = _trip.DlTripView.Id; } return(View(_model)); }