Exemplo n.º 1
0
 public void UpdatePrediction(PredictionDto oldPrediction, PredictionDto newPrediction)
 {
     for (int i = 0; i < predictions.Count; i++)
     {
         if (predictions[i].PredictionText == oldPrediction.PredictionText)
         {
             predictions[i].PredictionText = newPrediction.PredictionText;
         }
     }
 }
Exemplo n.º 2
0
 public void DeletePrediction(PredictionDto prediction)
 {
     for (int i = 0; i < predictions.Count; i++)
     {
         if (predictions[i].PredictionText == prediction.PredictionText)
         {
             predictions.RemoveAt(i);
             i--;
         }
     }
 }
Exemplo n.º 3
0
 public void DeletePrediction(PredictionDto prediction)
 {
     using IDbConnection db = new MySqlConnection("Server=127.0.0.1;Database=simplewebapp;Uid=root;Pwd=my-secret-pw;");
     db.Execute("DELETE from predictions where predictionText = @PredictionText", new { PredictionText = prediction.PredictionText });
 }
Exemplo n.º 4
0
 public void UpdatePrediction(PredictionDto oldPrediction, PredictionDto newPrediction)
 {
     using IDbConnection db = new MySqlConnection("Server=127.0.0.1;Database=simplewebapp;Uid=root;Pwd=my-secret-pw;");
     //db.Execute("update predictions set predictionText = '" + newPrediction.PredictionText + "' where predictionText = @predictionText", oldPrediction);
     db.Execute("update predictions set predictionText = @newPred where predictionText = @oldPred", new { oldPred = oldPrediction.PredictionText, newPred = newPrediction.PredictionText });
 }