Beispiel #1
0
        private async Task PopulateAccCEPRates(int claimOption, int siteId, int schoolGroupId)
        {
            AccCEPRates createPct = null;

            switch (claimOption)
            {
            case 0:
                createPct = await _repo.GetAsync <AccCEPRates>(w => w.AdmSchoolGroupID == null && w.AdmSiteID == null);

                break;

            case 1:
                createPct = await _repo.GetAsync <AccCEPRates>(w => (w.AdmSiteID ?? 0) == siteId);

                break;

            case 2:
                createPct = await _repo.GetAsync <AccCEPRates>(w => (w.AdmSchoolGroupID ?? 0) == schoolGroupId);

                break;
            }
            if (createPct == null)
            {
                switch (claimOption)
                {
                case 1:
                    await _repo.CreateAsync <AccCEPRates>(
                        new AccCEPRates()
                    {
                        AdmSiteID      = siteId,
                        CEPFreeRate    = 0,
                        CEPFullPayRate = 0
                    });

                    break;

                case 2:
                    await _repo.CreateAsync <AccCEPRates>(
                        new AccCEPRates()
                    {
                        AdmSchoolGroupID = schoolGroupId,
                        CEPFreeRate      = 0,
                        CEPFullPayRate   = 0
                    });

                    break;

                default:
                    await _repo.CreateAsync <AccCEPRates>(
                        new AccCEPRates()
                    {
                        CEPFreeRate    = 0,
                        CEPFullPayRate = 0
                    });

                    break;
                }
            }
        }
Beispiel #2
0
        private async Task PopulateAccCEPRates(int admSchoolGroupID)
        {
            var createPct = await _repository.GetAsync <AccCEPRates>(x => x.AdmSchoolGroupID == admSchoolGroupID);

            if (createPct == null)
            {
                createPct = new AccCEPRates
                {
                    AdmSchoolGroupID = admSchoolGroupID,
                    CEPFreeRate      = 0,
                    CEPFullPayRate   = 0
                };

                await _repository.CreateAsync(createPct);
            }

            _repository.SaveChanges();
        }