コード例 #1
0
        public PackageInfoViewModel GetPackageInfoById(int planId,int pkgId)
        {
            PackageInfoViewModel pkfInfo = new PackageInfoViewModel();

            int solutionId = _dbcontext.Plans.Where(m => m.Id == planId).Select(m => m.SolutionId).SingleOrDefault();
            pkfInfo.SolutionName = _dbcontext.Solutions.Where(m => m.Id == solutionId).Select(m => m.SolutionName).SingleOrDefault();
            pkfInfo.PlanName = _dbcontext.Plans.Where(m => m.Id == planId).Select(m => m.PlanName).SingleOrDefault();
            pkfInfo.PackageName = _dbcontext.Packages.Where(m => m.PackageId == pkgId && m.PlanId == planId).Select(m => m.PackageName).SingleOrDefault();
            pkfInfo.Cost = _dbcontext.Packages.Where(m => m.PackageId == pkgId && m.PlanId == planId).Select(m => m.Cost).SingleOrDefault();

            return pkfInfo;
        }
コード例 #2
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;
        }