public void Insert(GradeReport gradeReport)
 {
     using (IDbConnection dbConnection = Connection)
     {
         dbConnection.Open();
         dbConnection.Execute(
             "insert into students (FirstName, LastName, GradeID) "
             + "values(@FirstName, @LastName, @GradeID);"
             , new
         {
             FirstName = gradeReport.FirstName,
             LastName  = gradeReport.LastName,
             GradeID   = gradeReport.GradeID
         }
             , commandType: CommandType.Text);
     }
 }
 public void Update(GradeReport gradeReport)
 {
     using (IDbConnection dbConnection = Connection)
     {
         dbConnection.Open();
         dbConnection.Execute(
             "update students "
             + "set FirstName = @FirstName, LastName = @LastName, GradeID = @GradeID "
             + "where PersonID = @PersonID;"
             , new
         {
             PersonID  = gradeReport.PersonID,
             FirstName = gradeReport.FirstName,
             LastName  = gradeReport.LastName,
             GradeID   = gradeReport.GradeID
         }
             , commandType: CommandType.Text);
     }
 }
Exemple #3
0
 public void Put([FromBody] GradeReport gradeReport)
 {
     repository.Update(gradeReport);
 }
Exemple #4
0
 public void Post([FromBody] GradeReport gradeReport)
 {
     repository.Insert(gradeReport);
 }