public static AGE_DTO CastToDTO(AGE_TBL a) { return(new AGE_DTO() { ageId = a.ageId, begins = a.begins, ends = a.ends }); }
public static AGE_DTO getRange(int age) { using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) { AGE_TBL ages = ctx.AGE_TBL.Where(p => p.begins <= age && p.ends <= age).FirstOrDefault(); if (ages != null) { return(AGE_Casting.CastToDTO(ages)); } return(null); } }