public async Task <string> InsertList(List <MLFSSale> sales)
        {
            foreach (MLFSSale sale in sales)
            {
                if (string.IsNullOrEmpty(sale.ProviderName))
                {
                    try
                    {
                        List <MLFSPlan> plansFromIO = await _clientData.GetClientPlans(sale.ClientId);

                        MLFSPlan selectedPlanFromIO = plansFromIO.Where(x => x.PrimaryID == sale.IOReference).FirstOrDefault();
                        if (selectedPlanFromIO != null && selectedPlanFromIO.PlanType.ToLower() != "wrap")
                        {
                            List <MLFSFee> feesFromIO = await _clientData.GetClientFees(sale.ClientId);

                            MLFSFee selectedFeeFromIO = feesFromIO.Where(x => x.Plan.PrimaryID == selectedPlanFromIO.PrimaryID && x.IsRecurring).FirstOrDefault();
                            sale.AddPlanData(selectedPlanFromIO, selectedFeeFromIO);
                        }
                    }
                    catch
                    {
                        //No IO data found
                    }
                }
                _db.MLFSSales.Add(sale);
            }
            await _db.SaveChangesAsync();

            return("Success");
        }
Beispiel #2
0
        public async Task <int> InsertPeriod(MLFSReportingPeriod period)
        {
            _db.MLFSReportingPeriods.Add(period);
            await _db.SaveChangesAsync();

            return(period.Id);
        }
        public async Task <string> InsertList(List <MLFSIncome> income)
        {
            foreach (MLFSIncome i in income)
            {
                if (i.IsNewBusiness && i.Amount < 25)
                {
                    i.IncomeType = "Converted";
                }
                if (i.Amount < -250)
                {
                    i.IsClawBack = true;
                }
                _db.MLFSIncome.Add(i);
            }
            await _db.SaveChangesAsync();

            return("Success");
        }