public List <LoanOfficer> GetLoanOfficers(string officerKey = "") { var loanOfficers = _db.GetOfficer(officerKey) .Where(o => o.is_visible == true) .ToList(); var list = loanOfficers .Select(lo => new LoanOfficer() { id = lo.id, officer_name = lo.officer_name, description = lo.description, image = lo.image ?? EsmGlobals.MissingImageFilename, sort_order = lo.sort_order ?? 100, is_visible = lo.is_visible, biography = lo.biography, biography_title = lo.biography_title, officer_key = lo.officer_key, nmls_number = lo.nmls_number, email_address = lo.email_address, mailing_address = lo.mailing_address, primary_phone_number = lo.primary_phone_number } ) .OrderBy(o => o.sort_order) .ToList(); return(list); }
// todo: this returns too much info for just the officer dropdown. return only needed fields. public static Officer GetOfficer(string officerKey) { Officer officer = null; using (var context = new EasySpeedyMortgagesEntities()) { officer = (from o in context.GetOfficer(officerKey) select new Officer() { biography = o.biography, biography_title = o.biography_title, description = o.description, id = o.id, image = o.image ?? EsmGlobals.MissingImageFilename, officer_name = o.officer_name, nmls_number = o.nmls_number, officer_key = o.officer_key }) .FirstOrDefault(); } return(officer); }