public void UpdateCountryPollution(CountryPollution countryPollution) { if (countryPollution.ID != 0) { string sql = "update CountryPollution set Pollution = @Pollution, Year = @Year, CountryId = @CountryId where Id = @Id"; db.Execute(sql, new { countryPollution.Pollution, countryPollution.Year, countryPollution.CountryId, countryPollution.ID }); } }
public void DeleteCountryPollution(CountryPollution countryPollution) { string sql = "Delete CountryPollution where Id = @Id"; db.Execute(sql, new { countryPollution.ID }); }
public void InsertCountryPollution(CountryPollution countryPollution) { string sql = "insert into CountryPollution values (@CountryId,@Year,@Pollution)"; db.Execute(sql, new { countryPollution.CountryId, countryPollution.Year, countryPollution.Pollution }); }