private NurseDTO ToNurseDTO(Nurse s) { NurseDTO dto = new NurseDTO(); dto.nurse_ID = s.nurse_ID; dto.nurse_name = s.nurse_name; dto.position = s.position; dto.salary = s.salary; dto.sex = s.sex; dto.nurse_dept = s.nurse_name; return(dto); }
private NurseDTO ToDTO(Nurse nur) { NurseDTO dto = new NurseDTO(); dto.nurse_ID = nur.nurse_ID; dto.nurse_name = nur.nurse_name; dto.sex = nur.sex; dto.nurse_dept = nur.nurse_dept; dto.position = nur.position; dto.salary = nur.salary; return(dto); }
public NurseDTO GetNurseByIDe(string ID)//按ID查找 { using (MyContext ctx = new MyContext()) { var s = ctx.Nurses.SingleOrDefault(e => e.nurse_ID == ID); if (s == null) { return(null); } NurseDTO dto = new NurseDTO(); dto.nurse_ID = s.nurse_ID; dto.nurse_name = s.nurse_name; dto.nurse_dept = s.nurse_dept; dto.position = s.position; dto.salary = s.salary; dto.sex = s.sex; return(dto); } }
public IEnumerable <NurseDTO> GetNurseByID(string ID)//按ID查找 { using (MyContext ctx = new MyContext()) { var s = ctx.Nurses.SingleOrDefault(e => e.nurse_ID == ID); if (s == null) { return(null); } List <NurseDTO> list = new List <NurseDTO>(); NurseDTO dto = new NurseDTO(); dto.nurse_ID = s.nurse_ID; dto.nurse_name = s.nurse_name; dto.nurse_dept = s.nurse_dept; dto.position = s.position; dto.salary = s.salary; dto.sex = s.sex; list.Add(dto); return(list); } }
public IEnumerable <NurseDTO> GetAllNurse()//按名查找 { using (MyContext ctx = new MyContext()) { var docs = ctx.Nurses; if (docs == null) { return(null); } List <NurseDTO> list = new List <NurseDTO>(); foreach (var s in docs) { NurseDTO dto = new NurseDTO(); dto.nurse_ID = s.nurse_ID; dto.nurse_name = s.nurse_name; dto.nurse_dept = s.nurse_dept; dto.position = s.position; dto.salary = s.salary; dto.sex = s.sex; list.Add(dto); } return(list); } }