public List <UserTranscationInfo> GetUserMonthSTT(int userId, int month) { var trans = _transactionRepository.GetAll().Where(t => (t.SenderId == userId || t.ReceiverId == userId) && t.Time.Month == month); List <UserTranscationInfo> listUti = new List <UserTranscationInfo>(); UserTranscationInfo uti = null; foreach (var tran in trans) { uti = new UserTranscationInfo() { Amount = tran.Amount, Detail = tran.Detail, State = tran.State, Time = tran.Time, Type = tran.Type }; listUti.Add(uti); } return(listUti); }
public List <UserTranscationInfo> GetCompanyMonthSTT(int month) { var trans = _transactionRepository.GetAll().Where(t => t.Type == PaymentConstants.PAYMENT_TYPE_PAY && t.Time.Month == month); List <UserTranscationInfo> listUti = new List <UserTranscationInfo>(); UserTranscationInfo uti = null; foreach (var tran in trans) { uti = new UserTranscationInfo() { Amount = tran.Amount, Detail = tran.Detail, State = tran.State, Time = tran.Time, Type = tran.Type }; listUti.Add(uti); } return(listUti); }
public UserWalletInfo GetWallet(int userId) { UserWalletInfo userWalletInfo = null; Wallet wallet = _walletRepository .GetAll() .Where(w => w.UserId == userId) .FirstOrDefault(); if (wallet != null) { userWalletInfo = new UserWalletInfo() { Id = wallet.Id, Balance = wallet.Balance, UserId = wallet.UserId }; List <Transaction> transactions = _transactionRepository.GetAll().Where(t => t.SenderId == userId || t.ReceiverId == userId).ToList(); UserTranscationInfo uti = null; foreach (var transaction in transactions) { uti = new UserTranscationInfo() { Amount = transaction.Amount, Detail = transaction.Detail, State = transaction.State, Time = transaction.Time, Type = transaction.Type }; userWalletInfo.Transactions.Add(uti); } userWalletInfo.Transactions.OrderBy(t => t.Time); } return(userWalletInfo); }