Exemplo n.º 1
0
 private Waypoint QuickAddArrivingWaypoint(TripQuickAddViewModel vm)
 {
     return new Waypoint
     {
         Order = 2,
         City = vm.City,
         State = vm.State,
         Arriving = vm.DepartingDate
     };
 }
Exemplo n.º 2
0
 private Waypoint QuickAddDepartingWaypoint(TripQuickAddViewModel vm)
 {
     var settings = settingsRepository.Query().ToList();
     return new Waypoint
     {
         Order = 1,
         City = settings.First(s => s.Key == "City").Value,
         State = settings.First(s => s.Key == "State").Value,
         Departing = vm.DepartingDate
     };
 }
Exemplo n.º 3
0
        public ActionResult QuickAdd(TripQuickAddViewModel vm)
        {
            var trip = new Trip
            {
                StatusId = 1,
                AirplaneId = vm.AirplaneId,
                Name = vm.TripName,
                Waypoints = new Collection<Waypoint>()
            };
            trip.Waypoints.Add(QuickAddDepartingWaypoint(vm));
            trip.Waypoints.Add(QuickAddArrivingWaypoint(vm));
            tripRepository.InsertOrUpdate(trip);
            tripRepository.CommitChanges();

            return JsonResult(new { Success = true, trip });
        }