Ejemplo n.º 1
0
        public BusesEditViewModel()
        {
            busService = (App.Current as App).Container.GetService <IBusService>();

            // Cast object to BusModel and assign
            busModelToEdit = busService.GetBusToEdit() as BusModel;

            // Set bus tag name for label
            BusTag = busModelToEdit.BusTag;

            PublishEditBusCommand = new RelayCommand(
                async() =>
            {
                var messageDialog = new MessageDialog("Are you sure you want to commit these changes?", "Accept Bus Changes");
                messageDialog.Commands.Add(new UICommand("Yes", null));
                messageDialog.Commands.Add(new UICommand("No", null));
                messageDialog.DefaultCommandIndex = 0;
                messageDialog.CancelCommandIndex  = 1;
                var cmd = await messageDialog.ShowAsync();

                if (cmd.Label == "Yes")
                {
                    busService.EditBus(BusTag, NewBusTag, NewVRN);
                }

                NewBusTag = "";
                NewVRN    = "";

                NavigationService.Navigate(typeof(BusesPage));
            });
        }
Ejemplo n.º 2
0
 public IHttpActionResult EditBus(int id, BusViewModel bus)
 {
     return(Ok(busService.EditBus(id, bus)));
 }