Пример #1
0
        public ActionResult Earnings()
        {
            var model      = new EarningModel();
            var customer   = _customerService.GetCustomerId(this.CustomerId);
            var commission = customer.GetCustomerAttributeValue <decimal>(CustomerAttributeNames.Commission);

            model.CustomerId = customer.Id;
            model.Commission = commission;

            var dateStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            var dateEnd   = DateTime.Now.AddMonths(1).AddDays(-1);
            var applies   = _applyCashService.GetAllApplyCashs(createdFrom: dateStart, createdTo: dateEnd, customerId: this.CustomerId, audit: (int)AuditStatus.Audited);

            model.CurrentWithdrawalAmount = applies.Items.Sum(a => a.Amount);
            model.CurrentWithdrawals      = applies.TotalCount;

            var comms = _commissionServicer.GetAllCommissions(customerId: this.CustomerId, createdFrom: dateStart, createdTo: dateEnd);

            model.CurrentCommissionCount  = comms.TotalCount;
            model.CurrentCommissionAmount = comms.Items.Sum(c => c.ReturnAmount);
            return(View(model));
        }
Пример #2
0
        public async Task <IEnumerable <CommissionsViewModel> > GetAllCommissions()
        {
            var result = await _comService.GetAllCommissions();

            return(result);
        }