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); } }
public void Put([FromBody] GradeReport gradeReport) { repository.Update(gradeReport); }
public void Post([FromBody] GradeReport gradeReport) { repository.Insert(gradeReport); }