public ValueItem CalculateSharesTotal(CurrencyEnum currency = CurrencyEnum.USD)
        {
            decimal total = 0m;

            foreach (var company in _dataProvider.GetCompanies())
            {
                total += _exchangingService.GetValueInCurrency(company.TotalPrice, currency);
            }

            return(new ValueItem(currency, total));
        }
Esempio n. 2
0
        public ServiceResult <IList <Company> > GetCompanies(PageRequest pageInfo)
        {
            string errorMessage;
            var    isValid = ValidatePageRequest(pageInfo, out errorMessage);

            if (!isValid)
            {
                return(ServiceResult <IList <Company> > .CreateErrorResult(errorMessage));
            }

            var result = _companyProvider.GetCompanies(pageInfo);

            return(ServiceResult <IList <Company> > .CreateSuccessResult(result));
        }
Esempio n. 3
0
        public async Task <ActionResult> GetCompanies()
        {
            var companies = await _companyProvider.GetCompanies();

            return(Json(companies, JsonRequestBehavior.AllowGet));
        }