public List <IIncome> GetAll(int userId, int currentPage, bool fromSQLServer, List <IIncomeType> filteredIncomeTypes) { if (fromSQLServer) { return(_incomeRepository.GetAll(userId)); } else //From MongoDB { //Initialize Timer //Stopwatch sw1 = new Stopwatch(); //sw1.Start(); //List<IIncome> incomeDocuments = _incomeMongoRepository.GetAll(userId, currentPage, this.IncomeDate, filteredIncomeTypes); //Fetching all collections from MongoDB //sw1.Stop(); //var mongoLingValue = sw1.ElapsedTicks; //Stopwatch sw = new Stopwatch(); //sw.Start(); return(_incomeMongoRepository.GetAllByMongoQuery(userId, currentPage, this.IncomeDate, filteredIncomeTypes)); //sw.Stop(); //var queryValue = sw.ElapsedTicks; } }
public async Task <ICollection <Income> > GetIndividualIncomeAsync(string ownerUserId) { return(await _incomeRepository.GetAll() .Where(income => income.Owner.OwnerUserId == ownerUserId) .Include(income => income.Employer) .Include(income => income.Classification).ToListAsync().ConfigureAwait(false)); }
public static decimal CalculateTotalIncome(this IIncomeRepository incomeRepository, Guid budgetId) { var totalIncome = incomeRepository.GetAll() .Where(x => x.BudgetId == budgetId).Sum(y => y.Value); return(totalIncome); }
public static bool IsIncomeExist(this IIncomeRepository incomeRepository, Guid id) { var incomeExist = incomeRepository.GetAll().Where(x => x.Id == id).Any(); if (incomeExist) { return(true); } return(false); }
public async Task <ActionResult <IEnumerable <Income> > > GetIncomes() { var user = await _repository.ValidUser(GetTokenUserId()); if (user == null) { return(NotFound()); } var incomes = await _repository.GetAll(user.Id); if (incomes == null) { return(NotFound()); } return(Ok(incomes)); }
// GET: Income public async Task <IActionResult> Index() { return(View(await _repository.GetAll())); }
public IEnumerable <IncomeQuestionnaire> GetAll() { return(_repository.GetAll()); }
public IEnumerable <Income> GetAll() { return(_incomeRepository.GetAll()); }