예제 #1
0
        private async Task RemoveTrips(TripsActionModel actionView)
        {
            var client = await ApiTools.GetAuthenticatedClient(HttpContext);

            foreach (var actionViewTrip in actionView.Trips)
            {
                if (actionViewTrip.IsSelected)
                {
                    await client.DeleteAsync($"{_configuration["Api"]}/api/trip/{actionViewTrip.Trip.TripId}");
                }
            }
        }
예제 #2
0
        public async Task <IActionResult> ModifyTrips(TripsActionModel actionView)
        {
            switch (actionView.Action)
            {
            case "removeTrips":
                await RemoveTrips(actionView);

                break;

            case "setVehicle":
                await SetVehicle(actionView);

                break;
            }

            return(RedirectToAction("Index"));
        }
예제 #3
0
        private async Task SetVehicle(TripsActionModel actionView)
        {
            var client = await ApiTools.GetAuthenticatedClient(HttpContext);

            foreach (var actionViewTrip in actionView.Trips)
            {
                if (actionViewTrip.IsSelected)
                {
                    var content = ApiTools.GetHttpContent(new Trip
                    {
                        TripId  = actionViewTrip.Trip.TripId,
                        Vehicle = new Vehicle {
                            VehicleId = actionView.SelectedVehicleId
                        }
                    });

                    await client.PutAsync($"{_configuration["Api"]}/api/trip/setVehicle", content);
                }
            }
        }