Exemple #1
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (logger.IsWarnEnabled)
            {
                logger.Warn(txtWorkoutName.Text);
            }
            int result = 0;

            workout = (WorkoutType)dgWorkouts.SelectedItem;
            if (workout != null)
            {
                workout.Name = txtWorkoutName.Text;
                workout.CaloriesPerMinute = Int32.Parse(txtWorkoutCalories.Text);
                result = WorkoutTypeManager.Update(workout);
            }
            Reload();
            if (result == 1)
            {
                MessageBox.Show("Success!");
            }
            else
            {
                MessageBox.Show("Failure");
            }
        }
Exemple #2
0
        public void UpdateTest()
        {
            List <WorkoutType> workoutTypes = WorkoutTypeManager.Load();
            WorkoutType        workoutType  = workoutTypes.FirstOrDefault(u => u.Name == "Running");

            workoutType.CaloriesPerMinute = 12;
            int results = WorkoutTypeManager.Update(workoutType, true);

            Assert.IsTrue(results > 0);
        }
Exemple #3
0
 // PUT api/values/5
 public int Put([FromBody] WorkoutType value)
 {
     return(WorkoutTypeManager.Update(value));
 }