public ActionResult Update([DataSourceRequest]DataSourceRequest request, SupplementsViewModel vM) { if (ModelState.IsValid) { this.playerService.UpdateResources(vM.Id, vM.Energy, vM.Crystal, vM.Metal); } return Json(new[] { vM }.ToDataSourceResult(request, ModelState)); }
protected override void show(bool reload) { //if (ApplicationState.Current.TrainingDay.TrainingDay.Supplements == null) //{ // var entry = new SuplementsEntryDTO(); // ApplicationState.Current.TrainingDay.TrainingDay.Objects.Add(entry); // entry.TrainingDay = ApplicationState.Current.TrainingDay.TrainingDay; //} viewModel = new SupplementsViewModel(Entry); Connect(pivot, headerOldTrainingDate, viewModel.ShowOldTraining, lstOldItems); if (SelectedSupplement != null) { var model = viewModel.AddSupplementItem(); model.Item.Suplement = SelectedSupplement; SelectedSupplement = null; } DataContext = viewModel; headerTrainingDate.Text = viewModel.TrainingDate; //if (ApplicationState.Current.Cache.Supplements.IsLoaded || viewModel.Supplements.Count == 0) //{ // DataContext = viewModel; // headerTrainingDate.Text = viewModel.TrainingDate; //} //else //{ // progressBar.ShowProgress(true, ApplicationStrings.SupplementsPage_ProgressRetrieveSupplements); // ApplicationState.Current.Cache.Supplements.Loaded += (s, a) => // { // if (ApplicationState.Current.Cache.Supplements.IsLoaded) // { // DataContext = viewModel; // } // else // { // BAMessageBox.ShowError(ApplicationStrings.SupplementChooserViewModel_ErrRetrieveSupplements); // } // headerTrainingDate.Text = viewModel.TrainingDate; // progressBar.ShowProgress(false); // }; // ApplicationState.Current.Cache.Supplements.Load(); //} buildApplicationBar(); lblNoSupplements.Visibility = Entry.Items.Count == 0? System.Windows.Visibility.Visible: System.Windows.Visibility.Collapsed; }