When i click the submit button and fire this code it inserts it into the databse correctly but seems to duplication depending on how many entries already exist. Is there a way i can set a loop or if statement to limit to one entry, i tried to do via the datetime but because the multiple entries go in a second apart it wont work. Any help appreciated. Still a beginner in Xamarin.
Some of my code included in my submit button click is :
async Task AddInitialFeedback(string usersymptomid)
{
SymptomFeedback symptomFeedback = new SymptomFeedback();
symptomFeedback.Usersymptomid = usersymptomid;
symptomFeedback.Intensity = RatingSlider.Value.ToString();
symptomFeedback.UserID = Helpers.Settings.UserKey;
symptomFeedback.DateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
symptomFeedback.Datetimelimit = DateTime.Now.AddMinutes(30).ToString("g");
// symptomFeedback.Symptomfeedback = Symptomfeedback.Text.ToString();
try
{
await symptomfeedbackmanager.AddSymptomfeedback(symptomFeedback);
//We have to null the id so that we are not always updating the existing feedback item
symptomFeedback.Id = null;
}
catch (Exception ex)
{
Analytics.TrackEvent(ex.ToString());
}
}