/// <summary> Updates one existing patient in the database /// <param name="patient"> Inner_Patient Object - represents the fields of a Patient in the database </param> /// <returns> no return </returns> /// </summary> public async Task UpdatePatientAsync(Inner_Patient patient) { Data_Patient currentEntity = await _context.Patients.FindAsync(patient.PatientId); Data_Patient newEntity = Mapper.UnMapPatient(patient); _context.Entry(currentEntity).CurrentValues.SetValues(newEntity); await Save(); }
// ! *********************************** // ! *********** Patient ************** // ! *********************************** public static Inner_Patient MapPatient(Data_Patient patient) { return(new Inner_Patient { PatientId = patient.PatientId, PatientAddress1 = patient.PatientAddress1, PatientBirthDay = patient.PatientBirthDay, PatientCity = patient.PatientCity, PatientFirstName = patient.PatientFirstName, PatientZipcode = patient.PatientZipcode, PatientLastName = patient.PatientLastName, PatientPhoneNumber = patient.PatientPhoneNumber, PatientPassword = patient.PatientPassword, PatientState = patient.PatientState, PatientEmail = patient.PatientEmail, IsAdmin = patient.IsAdmin, Insurance = MapInsurance(patient.Insurance) }); }