Example #1
0
 public IEnumerable <Workout> GetAllWorkouts()
 {
     using (var con = WorkoutDatabase.GetConnection())
     {
         return(con.Query <Workout>("SELECT w.Id, w.Distance, wt.Name WorkoutType FROM Workouts w LEFT JOIN WorkoutTypes wt ON w.TypeId = wt.Id"));
     }
 }
Example #2
0
 public void Insert(double distance, int typeId)
 {
     using (var con = WorkoutDatabase.GetConnection())
     {
         con.Execute("INSERT INTO Workouts (Distance, TypeId) VALUES (@Distance, @TypeId)", new { Distance = distance, TypeId = typeId });
     }
 }
 public IEnumerable <WorkoutType> GetWorkoutTypes()
 {
     using (var con = WorkoutDatabase.GetConnection())
     {
         return(con.Query <WorkoutType>("SELECT Id, Name FROM WorkoutTypes"));
     }
 }