Ejemplo n.º 1
0
        public async Task <ProviderAC> GetProviderById(long id)
        {
            ProviderAC providerAC = new ProviderAC();

            TeleBillingUtility.Models.Provider provider = await _dbTeleBilling_V01Context.Provider.FirstAsync(x => x.Id == id);

            providerAC = _mapper.Map <ProviderAC>(provider);

            List <Providerservice> listOfService = await _dbTeleBilling_V01Context.Providerservice.Where(x => x.ProviderId == id && !x.IsDelete).Include(x => x.ServiceType).ToListAsync();

            providerAC.ServiceTypes = new List <DrpResponseAC>();
            foreach (var item in listOfService)
            {
                DrpResponseAC serviceType = new DrpResponseAC();
                serviceType.Id   = item.ServiceTypeId;
                serviceType.Name = item.ServiceType.Name;

                providerAC.ServiceTypes.Add(serviceType);
            }

            List <Providercontactdetail> providerContactDetails = await _dbTeleBilling_V01Context.Providercontactdetail.Where(x => x.ProviderId == provider.Id && !x.IsDeleted).ToListAsync();

            providerAC.ProviderContactDetailACList = new List <ProviderContactDetailAC>();
            providerAC.ProviderContactDetailACList = _mapper.Map(providerContactDetails, providerAC.ProviderContactDetailACList);

            return(providerAC);
        }
Ejemplo n.º 2
0
        public async Task <PackageDetailAC> GetPackageById(long id)
        {
            Providerpackage providerPackage = await _dbTeleBilling_V01Context.Providerpackage.FirstOrDefaultAsync(x => x.Id == id);

            PackageDetailAC packageDetailAC = _mapper.Map <PackageDetailAC>(providerPackage);

            if (!string.IsNullOrEmpty(packageDetailAC.HandsetDetailIds))
            {
                packageDetailAC.HandsetList = new List <DrpResponseAC>();
                List <string> lstHandsetIds = packageDetailAC.HandsetDetailIds.Split(',').ToList();
                foreach (string handsetId in lstHandsetIds)
                {
                    DrpResponseAC    drpResponseAC = new DrpResponseAC();
                    long             newHandsetId  = Convert.ToInt64(handsetId);
                    MstHandsetdetail handsetDetail = await _dbTeleBilling_V01Context.MstHandsetdetail.FirstOrDefaultAsync(x => x.Id == newHandsetId && !x.IsDelete);

                    drpResponseAC.Id   = handsetDetail.Id;
                    drpResponseAC.Name = handsetDetail.Name;
                    packageDetailAC.HandsetList.Add(drpResponseAC);
                }
            }
            return(packageDetailAC);
        }