public JsonResult getDoctorByID(long serviceProviderID, long typeId, long itemid) { // long typid = 56; // retturn only doctor ServiceProvider serviceProviders = null; ServiceProvidedWithReferrerFee onlyserviceProviders = new ServiceProvidedWithReferrerFee(); using (ServiceProviderRepository repository = new ServiceProviderRepository()) { serviceProviders = repository.GetById(serviceProviderID); ServiceProvidedWithReferrerFee serviceProvider = new ServiceProvidedWithReferrerFee(); Contact contact = new Contact(); serviceProvider.Contact = contact; serviceProvider.Contact.FirstName = serviceProviders.Contact.FirstName; serviceProvider.Contact.LastName = serviceProviders.Contact.LastName; serviceProvider.Id = serviceProviders.Id; serviceProvider.Speciality = serviceProviders.Speciality; Referral referral = new Referral(); using (ReferralRepository referrerrepository = new ReferralRepository()) { referral = referrerrepository.GetReferrer(serviceProvider.Id, itemid); serviceProvider.ReferralFee = referral.ReferralFee; } onlyserviceProviders = serviceProvider; } return(Json(onlyserviceProviders, JsonRequestBehavior.AllowGet)); }
public JsonResult getdoctorpartialname(string name, long typeId, long itemid) { // long typid = 56; // retturn only doctor List <ServiceProvider> serviceProviders = null; List <ServiceProvidedWithReferrerFee> onlyserviceProviders = new List <ServiceProvidedWithReferrerFee>(); using (ServiceProviderRepository repository = new ServiceProviderRepository()) { serviceProviders = repository.GetServiceProviderPartialName(name, typeId).ToList(); foreach (ServiceProvider item in serviceProviders) { ServiceProvidedWithReferrerFee serviceProvider = new ServiceProvidedWithReferrerFee(); Contact contact = new Contact(); serviceProvider.Contact = contact; serviceProvider.Contact.FirstName = item.Contact.FirstName; serviceProvider.Contact.LastName = item.Contact.LastName; serviceProvider.Id = item.Id; serviceProvider.Speciality = item.Speciality; Referral referral = new Referral(); using (ReferralRepository referrerrepository = new ReferralRepository()) { referral = referrerrepository.GetReferrer(serviceProvider.Id, itemid); serviceProvider.ReferralFee = referral.ReferralFee; } onlyserviceProviders.Add(serviceProvider); } } return(Json(onlyserviceProviders, JsonRequestBehavior.AllowGet)); }