Exemplo n.º 1
0
        public PackageInfoViewModel GetPackageInfoByIdImMemory(int planId, int pkgId)
        {
            StepOneDBInMemoryDatas datas = new StepOneDBInMemoryDatas();
            PackageInfoViewModel pkfInfo = new PackageInfoViewModel();

            int solutionId = datas.plans.Where(m => m.Id == planId).Select(m => m.SolutionId).SingleOrDefault();
            pkfInfo.SolutionName = datas.solutions.Where(m => m.Id == solutionId).Select(m => m.SolutionName).SingleOrDefault();
            pkfInfo.PlanName = datas.plans.Where(m => m.Id == planId).Select(m => m.PlanName).SingleOrDefault();
            pkfInfo.PackageName = datas.pkg.Where(m => m.PackageId == pkgId && m.PlanId == planId).Select(m => m.PackageName).SingleOrDefault();
            pkfInfo.Cost = datas.pkg.Where(m => m.PackageId == pkgId && m.PlanId == planId).Select(m => m.Cost).SingleOrDefault();

            return pkfInfo;
        }
Exemplo n.º 2
0
        public List<PlanViewModel> GetPremiuemSupportPlanInMemory(int solutionId)
        {
            StepOneDBInMemoryDatas datas = new StepOneDBInMemoryDatas();

            List<PlanViewModel> premiumSupportsPlan = new List<PlanViewModel>();

            datas.plans.Where(m => m.SolutionId == solutionId).ToList().ForEach(m =>
            {
                PlanViewModel planViewModel = new PlanViewModel { Id = m.Id, PlanName = m.PlanName, SolutionId = m.SolutionId, Cost = m.Cost };
                List<PackageViewModel> packages = new List<PackageViewModel>();

                datas.pkg.Where(l => l.PlanId == m.Id).ToList().ForEach(j =>
                {
                    packages.Add(new PackageViewModel { PackageId = j.PackageId, PlanId = j.PlanId, PackageName = j.PackageName, CreatedDate = j.CreatedDate, Cost = j.Cost });
                });

                planViewModel.Packages = packages;

                premiumSupportsPlan.Add(planViewModel);
            });

            return premiumSupportsPlan;
        }