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)); }
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)); }
public async Task <ActionResult> GetCompanies() { var companies = await _companyProvider.GetCompanies(); return(Json(companies, JsonRequestBehavior.AllowGet)); }