public bool AddPatient(Patient patient) { try { patient.ID = Guid.NewGuid(); db.Insert(patient); } catch (Exception) { return false; } return true; }
public bool Delete(Patient patient) { string sqlQuery = "Delete from [dbo].[patients] where [id] = @ID"; var result = false; using (var conn = new SqlConnection(connectionString)) { conn.Open(); conn.Execute(sqlQuery, new { patient.ID, }); result = true; } return result; }
public bool Update(Patient patient) { string sqlQuery = "Update [dbo].[patients] set [name] = @Name,[age] = @Age,[currentdoctorid] = @CurrentDoctorID where [id] = @ID"; var result = false; using (var conn = new SqlConnection(connectionString)) { conn.Open(); conn.Execute(sqlQuery, new { patient.ID, patient.Name, patient.Age, patient.CurrentDoctorID }); result = true; } return result; }
public bool Insert(Patient patient) { string sqlQuery = "INSERT INTO [dbo].[patients]([id],[name],[age],[currentdoctorid]) VALUES (@ID, @Name, @Age, @CurrentDoctorID)"; var result = false; using (var conn = new SqlConnection(connectionString)) { conn.Open(); conn.Execute(sqlQuery, new { patient.ID, patient.Name, patient.Age, patient.CurrentDoctorID }); result = true; } return result; }
public Patient CreateNewPatient(string userId, Dentist dentist) { var p = this.patients.GetById(userId); if (p == null) { Patient patient = new Patient() { Id = userId }; patient.Dentists.Add(dentist); this.patients.Add(patient); this.patients.Save(); return patient; }else { p.Dentists.Add(dentist); this.patients.Save(); } return p; }
public bool UpdatePatient(Guid ID, Patient patient) { try { db.Update(patient); } catch (Exception) { return false; } return true; }
public bool Delete(Patient patient) { throw new NotImplementedException(); }
public bool Insert(Patient patient) { throw new NotImplementedException(); }
protected override void Seed(PiContext context) { Patient p = new Patient(); p.Email = "*****@*****.**"; p.PasswordHash = "123456789"; p.UserName = "******"; context.Users.Add(p); CategoriePost cp = new CategoriePost(); cp.Libelle = "Denatire"; cp.Description = "Dentaire"; context.CategoriePosts.Add(cp); CategoriePost cp2 = new CategoriePost(); cp.Libelle = "Cardio"; cp.Description = "Cardio"; context.CategoriePosts.Add(cp2); CategoriePost cp3 = new CategoriePost(); cp.Libelle = "Esthetique"; cp.Description = "Esthetique"; context.CategoriePosts.Add(cp2); CategoriePost cp4 = new CategoriePost(); cp.Libelle = "Esthetique"; cp.Description = "Esthetique"; context.CategoriePosts.Add(cp4); CategoriePost cp5 = new CategoriePost(); cp.Libelle = "gynecologi."; cp.Description = "gynecologie."; context.CategoriePosts.Add(cp4); CategoriePost cp6 = new CategoriePost(); cp.Libelle = "pediatrie"; cp.Description = "pediatrie"; context.CategoriePosts.Add(cp6); CategoriePost cp7 = new CategoriePost(); cp.Libelle = "neurologie"; cp.Description = "neurologie"; context.CategoriePosts.Add(cp6); // context.SaveChanges(); List <Appointment> appointments = new List <Appointment>() { new Appointment { state = State.Done }, new Appointment { state = State.Done }, new Appointment { state = State.Done }, new Appointment { state = State.Done }, new Appointment { state = State.Done }, new Appointment { state = State.Done }, new Appointment { state = State.Done }, new Appointment { state = State.Done } }; context.Appointments.AddRange(appointments); context.SaveChanges(); }