public void UpdateExercise(Exercise exercise) { tExercise dbExercise = _context.Exercises.SingleOrDefault(x => x.Id == exercise.Id && !x.IsDeleted); MapDomainToDb(exercise, dbExercise); _context.SaveChanges(); }
public int CreateExercise(Exercise exercise) { tExercise dbExercise = new tExercise(); MapDomainToDb(exercise, dbExercise); _context.AddAsync(dbExercise); _context.SaveChanges(); return(dbExercise.Id); }
private void MapDomainToDb(Exercise exercise, tExercise dbExercise) { dbExercise.Id = exercise.Id; dbExercise.Name = exercise.Name; }