public IEnumerable <ExpenseViewModel> GetExpense() { var source = _expenseRepository.GetAll(); var destination = Mapper.Map <IEnumerable <Expense_M>, IEnumerable <ExpenseViewModel> >(source); return(destination); }
public async Task <ExpenseListViewModel> Upload(IFormFile fileForm, string fileName, int expenseId) { var viewModel = new ExpenseListViewModel(); try { var expense = await _expenseRepository.Get(expenseId); if (fileForm != null && fileForm.Length > 0) { using (var ms = new MemoryStream()) { fileForm.CopyTo(ms); var fileRawData = ms.ToArray(); var salesDocument = new SalesDocumentForm() { ExpenseId = expenseId, Name = fileName, FileRawData = fileRawData }; await _salesDocumentRepository.Create(salesDocument); } } viewModel.VirtualAccountId = expense.VirtualAccountId; viewModel.Expenses = await _expenseRepository.GetAll(expense.VirtualAccountId); } catch (Exception e) { viewModel.Error = new GackoError(e); } return(viewModel); }
public async Task <ICollection <Expense> > GetIndividualExpensesAsync(string ownerUserId) { return(await _expenseRepository.GetAll() .Where(expense => expense.ExpenseOwner.OwnerUserId == ownerUserId) .Include(expense => expense.ExpenseClassification) .ToListAsync().ConfigureAwait(false)); }
public static decimal CalculateTotalExpense(this IExpenseRepository expenseRepository, Guid budgetId) { var totalExpense = expenseRepository.GetAll() .Where(x => x.BudgetId == budgetId).Sum(z => z.Value); return(totalExpense); }
public async Task <Response <List <ExpenseDTO> > > Handle(GetExpensesForPurchaseRecordRequest request, CancellationToken cancellationToken) { var expenseMappingProfile = new ExpenseMappingProfile(); var expenses = await _repository.GetAll((expense) => expense.PurchaseRecordId == request.PurchaseRecordId); var result = expenses.Select((expense) => expenseMappingProfile.ToDto(expense)).ToList(); return(new Response <List <ExpenseDTO> >(result)); }
public async Task <IList <ExpenseModel> > GetAll(int virtualAccountId) { var expenses = await _expenseRepository.GetAll(virtualAccountId); foreach (var expenseModel in expenses) { expenseModel.SalesDocuments = await _salesDocumentRepository.GetAll(expenseModel.Id); } return(expenses); }
public static bool IsExpenseExist(this IExpenseRepository expenseRepository, Guid id) { var expenseExist = expenseRepository.GetAll().Where(x => x.Id == id).Any(); if (expenseExist) { return(true); } return(false); }
private void LoadExpense() { var expense = expenseRepository.GetAll(Store.ActiveMonth, Store.ActiveYear); lvwExpense.Items.Clear(); foreach (var s in expense) { PopulateExpense(s); } }
public async Task <IActionResult> GetAllExpenses() { var AR = await _authorizationService.AuthorizeAsync(HttpContext.User, "Permission"); if (!AR.Succeeded) { return(Unauthorized()); } var expenses = await _repository.GetAll(); List <ExpenseDto> expensesDto = new List <ExpenseDto>(); expenses.ToList().ForEach(expense => expensesDto.Add(_mapper.Map <ExpenseDto>(expense))); return(Ok(expensesDto)); }
public override IActionResult Get() { try { var data = _repo.GetAll <Expense>(x => x .Include(x => x.Supplier) .Include(x => x.Currency) .Include(x => x.BranchOffice) .Include(x => x.PaymentType) .Where(y => y.Active == true)); return(Ok(data)); } catch (Exception ex) { return(Ok(new { status = -1, message = ex.Message })); } }
public IList <ExpenseObject> GetAllExpenseSheet() { try { List <ExpenseObject> exObjecttList = new List <ExpenseObject>(); foreach (Expense source in (IEnumerable <Expense>)expenseRepo.GetAll()) { ExpenseObject exObject = _Mapper.Map <Expense, ExpenseObject>(source); exObjecttList.Add(exObject); } return((IList <ExpenseObject>)exObjecttList); } catch (Exception ex) { throw ex; } }
public ActionResult <List <ExpenseModel> > GetAll() { var expenses = _expenseRepository.GetAll().ToList() ?? new List <Expense>(); var result = new List <ExpenseModel>(); expenses.ForEach(expense => { result.Add(new ExpenseModel() { Id = expense.Id, UserId = expense.UserId, Date = expense.Date, Amount = expense.Amount, Description = expense.Description, IsShared = expense.IsShared, SharedExpenseId = expense.SharedExpenseId }); }); return(result); }
public IEnumerable <Expense> GetAllExpenses(string userId) { var expenses = _expenseRepository.GetAll(userId); return(expenses); }
public IEnumerable <Expense> GetExpenses() { IList <Expense> expenses = expenseRepository.GetAll().ToList(); return(expenses); }
public IEnumerable <Expense> GetAll() { return(_expenseRepository.GetAll()); }
public async Task <IActionResult> GetAll() { var result = await _expenseRepository.GetAll(); return(Ok(result.OrderByDescending(x => x.Date))); }
public IList <AccountsExpenseSet> GetExpensesList() { return(_expenseRepository.GetAll()); }
public override List <Expense> GetAll() { return(_repository.GetAll().OrderByDescending(x => x.Modified).Take(10).ToList()); }
public ActionResult Get() { var expenses = _repo.GetAll(); return(Ok(expenses)); }
public async Task <IActionResult> GetAllExpenses(int idUser) { var expenses = await _expenseRepository.GetAll(idUser); return(Ok(expenses)); }
public ActionResult <IEnumerable <Expense> > Get() { return(_expenseRepository.GetAll().ToArray()); }
public async Task <ActionResult <IEnumerable <Expense> > > GetExpenses() { return(await _repository.GetAll()); }