private async Task <Guid> CreateWeeeReceivedAmounts(ObligatedReceivedDataAccess dataAccess, DatabaseWrapper database)
        {
            var organisation = ObligatedWeeeIntegrationCommon.CreateOrganisation();
            var scheme       = ObligatedWeeeIntegrationCommon.CreateScheme(organisation);
            var aatf         = ObligatedWeeeIntegrationCommon.CreateAatf(database, organisation);
            var @return      = ObligatedWeeeIntegrationCommon.CreateReturn(organisation, database.Model.AspNetUsers.First().Id);

            database.WeeeContext.Organisations.Add(organisation);
            database.WeeeContext.Schemes.Add(scheme);
            database.WeeeContext.Aatfs.Add(aatf);
            database.WeeeContext.Returns.Add(@return);

            await database.WeeeContext.SaveChangesAsync();

            var weeeReceived = new WeeeReceived(scheme, aatf, @return);

            var weeeReceivedAmount = new List <WeeeReceivedAmount>();

            foreach (var category in Enum.GetValues(typeof(WeeeCategory)).Cast <WeeeCategory>())
            {
                weeeReceivedAmount.Add(new WeeeReceivedAmount(weeeReceived, (int)category, (int)category, (int)category + 1));
            }

            await dataAccess.Submit(weeeReceivedAmount);

            return(@return.Id);
        }
Exemple #2
0
        private static async Task CreateWeeeReceivedAmounts(
            ObligatedReceivedDataAccess dataAccess,
            ReturnSchemeDataAccess returnSchemeDataAccess,
            Return @return,
            Aatf aatf,
            Scheme scheme)
        {
            var returnScheme = new ReturnScheme(scheme, @return);

            var weeeReceived = new WeeeReceived(scheme, aatf, @return);

            var weeeReceivedAmount = new List <WeeeReceivedAmount>();

            foreach (var category in Enum.GetValues(typeof(WeeeCategory)).Cast <WeeeCategory>())
            {
                weeeReceivedAmount.Add(new WeeeReceivedAmount(weeeReceived, (int)category, (int)category, (int)category + 1));
            }

            await returnSchemeDataAccess.Submit(new List <ReturnScheme> {
                returnScheme
            });

            await dataAccess.Submit(weeeReceivedAmount);
        }