private Patient_careDTO CareToDTO(Patient_care s) { Patient_careDTO dto = new Patient_careDTO(); dto.patient_ID = s.patient_ID; dto.nur_ID = s.nur_ID; dto.ward_ID = s.ward_ID; dto.name = s.name; dto.content = s.content; dto.start_time = s.start_time.ToString(); return(dto); }
public IEnumerable <Patient_careDTO> GetAll() { using (MyContext ctx = new MyContext()) { List <Patient_careDTO> list = new List <Patient_careDTO>(); foreach (var p in ctx.Patient_cares) { var dto = new Patient_careDTO(); dto.patient_ID = p.patient_ID; dto.name = p.name; dto.nur_ID = p.nur_ID; dto.ward_ID = p.ward_ID; dto.start_time = p.start_time.ToString(); dto.content = p.content; list.Add(dto); } return(list); } }
public IEnumerable <Patient_careDTO> GetByID(string patient_ID) { using (MyContext ctx = new MyContext()) { var pp = ctx.Patient_cares.AsNoTracking().Where(e => e.patient_ID == patient_ID); List <Patient_careDTO> list = new List <Patient_careDTO>(); foreach (var p in pp) { Patient_careDTO pdto = new Patient_careDTO(); pdto.patient_ID = p.patient_ID; pdto.content = p.content; pdto.name = p.name; pdto.nur_ID = p.nur_ID; pdto.start_time = p.start_time.ToString(); pdto.ward_ID = p.ward_ID; list.Add(pdto); } return(list); } }