public static void RemoveExercise(string type, ExerciseModel exercise) { if (type == "Chest") { ChestList.Remove(exercise); } else if (type == "Back") { BackList.Remove(exercise); } else if (type == "Legs") { LegsList.Remove(exercise); } else if (type == "Shoulders") { ShouldersList.Remove(exercise); } else if (type == "Arms") { ArmsList.Remove(exercise); } else if (type == "Abs") { AbsList.Remove(exercise); } App.Current.MainPage.Navigation.PopToRootAsync(); Application.Current.MainPage.Navigation.PushAsync(new WorkoutLogger.Views.ExerciseListPage(type)); DataService.UserDataService.SaveData(); }
public static void AddExercise(string type, string entry) { ExerciseModel newExercise = new ExerciseModel(); newExercise.Name = entry; List <LogModel> newData = new List <LogModel>(); LogModel data1 = new LogModel(); data1.Reps = 0; data1.Sets = 0; data1.Weights = 0; data1.Trend = 0; data1.Date = DateTime.Now.ToString("dd/MM/yy"); newData.Add(data1); newExercise.Data = newData; if (type == "Chest") { ChestList.Add(newExercise); } else if (type == "Back") { BackList.Add(newExercise); } else if (type == "Legs") { LegsList.Add(newExercise); } else if (type == "Shoulders") { ShouldersList.Add(newExercise); } else if (type == "Arms") { ArmsList.Add(newExercise); } else if (type == "Abs") { AbsList.Add(newExercise); } App.Current.MainPage.Navigation.PopToRootAsync(); Application.Current.MainPage.Navigation.PushAsync(new WorkoutLogger.Views.ExerciseListPage(type)); DataService.UserDataService.SaveData(); }