public ActionResult Put(IEnumerable<PatientsDoNotWantToBeCalled> patientsDoNotWantToBeCalled) { string toBeVoiced = string.Empty; try { foreach (var prov in patientsDoNotWantToBeCalled) { PatientsDoNotWantToBeCalled patientDoNotWantToBeCalled = new PatientsDoNotWantToBeCalled(); patientDoNotWantToBeCalled.NameID = prov.NameID; patientDoNotWantToBeCalled.FirstName = prov.FirstName; patientDoNotWantToBeCalled.LastName = prov.LastName; patientRecords.AddPatientThatDoesNotWantToBeCalled(patientDoNotWantToBeCalled); } return new JsonResult { Data = new { Success = true } }; } catch (Exception er) { string s1 = er.Message; return new JsonResult { Data = new { Success = false } }; } }
public void AddPatientThatDoesNotWantToBeCalled(PatientsDoNotWantToBeCalled patientsDoNotWantToBeCalled) { try { using (MySqlConnection db = new MySqlConnection(Database.ReminderConnection)) { string query = " insert into donotcall(NameId, FirstName, LastName)" + " values(@NameId, @FirstName, @LastName)"; int rowsAffectd = db.Execute(query, patientsDoNotWantToBeCalled); } } catch (Exception er) { Log.LogMessage(er.ToString()); } }