public async Task UpdateDb(int workoutId, int order, DB db) { var dbModel = new ExerciseSetDBModel { WorkoutId = workoutId, Order = order, BreakBetween = int.Parse(Time), Change = int.Parse(Change), Sets = int.Parse(Series), Exercise = Name, Reps = int.Parse(Repeats), Weight = int.Parse(Weight) }; if (dbId_.HasValue) { dbModel.Id = dbId_; await db.Database.Table <ExerciseSetDBModel>().DeleteAsync(e => e.Id == dbModel.Id); await db.Database.InsertAsync(dbModel); } else { dbModel.Id = await NextExerciseId(db); await db.Database.InsertAsync(dbModel); } }
public ExerciseVM(ExerciseSetDBModel exercise) { App.Debug(exercise.Id.ToString()); dbId_ = exercise.Id; Series = exercise.Sets.ToString(); Repeats = exercise.Reps.ToString(); Time = exercise.BreakBetween.ToString(); Weight = exercise.Weight.ToString(); Change = exercise.Change.ToString(); Name = exercise.Exercise; }
public Row(ExerciseSetDBModel exercise) { ViewModel = new ExerciseVM(exercise); InitializeComponent(); }