// הפונקציה מחפשת קהולית מתאימות לפי מחזר, סטטוס משפחתי ויכולת כספי public static List <ComunityDTO> getComunity(PersonalStatusDTO per) { using (MoveilEntities db = new MoveilEntities()) { if (per.QuienSoy == 2) { var com = db.Comunities.Where(p => p.CostoCode == per.StatusEconomico && p.SectorCode == per.Religion && p.anciano == true).ToList(); if (com == null || com.Count == 0) { var com2 = db.Comunities.Where(p => p.CostoCode == per.StatusEconomico && p.anciano == true).ToList(); if (com == null || com.Count == 0) { return(CONVERTERES.ComunityConverters.ConvertComunityListToDTO (db.Comunities.Where(p => p.CostoCode == per.StatusEconomico && p.SectorCode == per.Religion).ToList())); } else { return(CONVERTERES.ComunityConverters.ConvertComunityListToDTO(com)); } } else { return(CONVERTERES.ComunityConverters.ConvertComunityListToDTO(com)); } } else { var com = db.Comunities.Where(p => p.CostoCode == per.StatusEconomico && p.SectorCode == per.Religion).ToList(); if (com == null || com.Count == 0) { return(CONVERTERES.ComunityConverters.ConvertComunityListToDTO( db.Comunities.Where(p => p.SectorCode == per.Religion).ToList())); } else { return(CONVERTERES.ComunityConverters.ConvertComunityListToDTO(com)); } } } }
public IHttpActionResult getComunity(PersonalStatusDTO per) { return(Ok(BL.ComunityBL.getComunity(per))); }