private get_response_pharmacy _getPharmacy_ext(long m_id) { var mx = db.PHARMACY_ext.Where(a => a.rel_PHARMACY_id == m_id); get_response_pharmacy resp = new get_response_pharmacy(); foreach (var n in mx) { switch (n.attr_name) { case "fax_number": resp.fax_number = n.value; break; case "marketer_partner": resp.marketer_partner = n.value; break; case "pharmacy_fax_number": resp.pharmacy_fax_number = n.value; break; case "geographic_market": resp.geographic_market = n.value; break; case "insurance_provider": resp.insurance_provider = n.value; break; case "product_list": resp.product_list = n.value; break; } } return(resp); }
public IHttpActionResult GetPharmacy([FromUri] get_pharmacy pharmacy) { var m = db.PHARMACies.Find(pharmacy.id); List <get_response_pharmacy> resp = new List <get_response_pharmacy>(); if (m != null) { var ref_zip = db.ref_zip.Find(m.addr_zip_id); get_response_pharmacy ext = _getPharmacy_ext(m.id); List <zip_search_address2> addr = new List <zip_search_address2>(); if (ref_zip != null) { addr.Add(new zip_search_address2 { address1 = m.addr_address1, address2 = m.addr_address2 == null ? "" : m.addr_address2, city = ref_zip == null ? "" : ref_zip.city_name, state = ref_zip == null ? "" : ref_zip.city_state, state_long = ref_zip == null ? "" : ref_zip.city_state_long, zip = ref_zip == null ? "" : ref_zip.zip }); } resp.Add(new get_response_pharmacy { legal_entity_name = m.legal_entity_name, healthsplash_contact = m.healthsplash_contact, address = addr == null ? new List <zip_search_address2>() { } : addr, specialty_services = m.specialty_service, federal_tax_number = m.federal_tax_number, primary_phone = m.primary_phone, customer_service_number = m.customer_service_number, technology_platform_retrieval = m.technology_platform_retrieval, ncpdp_number = m.NCPDP_number, practice_npi_number = m.practice_npi_number, fax_number = ext.fax_number == null ? "" : ext.fax_number, marketer_partner = ext.marketer_partner == null ? "" : ext.marketer_partner, pharmacy_fax_number = ext.pharmacy_fax_number == null ? "" : ext.pharmacy_fax_number, insurance_provider = ext.insurance_provider == null ? "" : ext.insurance_provider, product_list = ext.product_list == null ? "" : ext.product_list, geographic_market = ext.geographic_market == null ? "": ext.geographic_market, primary_contact_name_first = m.prim_contact_name_first, primary_contact_name_last = m.prim_contact_name_last, primary_contacty_phone = m.prim_contact_phone, primary_contact_email = m.prim_contact_email, operational_name_first = m.oper_contact_name_first, operational_name_last = m.oper_contact_name_last, operational_phone = m.oper_contact_email, operational_email = m.oper_contact_email, financial_name_first = m.fina_contact_name_first, financial_name_last = m.fina_contact_name_last, financial_phone = m.fina_contact_phone, financial_email = m.fina_contact_email, authorize_signatory_name_first = m.auth_contact_name_first, authorize_signatory_name_last = m.auth_contact_name_last, authorize_signatory_phone = m.auth_contact_phone, authorize_signatory_email = m.auth_contact_email }); var ret1 = JsonConvert.SerializeObject(resp); var json1 = Newtonsoft.Json.Linq.JArray.Parse(ret1); string msg = resp.Count() + " Record found."; return(Json(new { data = json1, message = msg, success = true })); } return(Json(new { data = new string[] { }, message = "", success = false })); }