public ActionResult GetIndex(string userId) { string authHeader = this.HttpContext.Request.Headers["Authorization"]; TokenModel tokenModel = new TokenModel(); ClaimsPrincipal auth = tokenModel.GetPrincipal(authHeader); if (auth.Identity.IsAuthenticated) { AspNetUsers users = new AspNetUsers(); new ClickTracker("GetIndex", true, false, "userId " + users.getUserId(userId), auth.Identity.Name); Collections collection = new Collections(); List <Collections> collections = collection.GetCollections(userId, "TransactionList"); List <ReportedTransaction> flows = new List <ReportedTransaction>(); ReportedTransaction reportedTransaction = new ReportedTransaction(); foreach (Collections item in collections) { foreach (Account acc in item.Accounts) { flows.AddRange(reportedTransaction.GetTransactions(acc.Id)); } } return(Ok(flows)); } return(Ok("")); }
public ActionResult GetTransactions(string id, DateTime startDate, DateTime endDate) { string authHeader = this.HttpContext.Request.Headers["Authorization"]; TokenModel tokenModel = new TokenModel(); ClaimsPrincipal auth = tokenModel.GetPrincipal(authHeader); if (auth.Identity.IsAuthenticated) { GetTransactionsObj obj = new GetTransactionsObj() { StartDate = startDate, EndDate = endDate, Id = id }; ReportedTransaction transaction = new ReportedTransaction(); List <ReportedTransaction> transactions = transaction.GetTransactions(obj.Id); transactions = transactions.Where(x => x.DateCaptured <= obj.EndDate && x.DateCaptured >= obj.StartDate).Where(x => x.CFType.Id != "999").OrderByDescending(x => x.DateBooked).ToList(); return(Ok(transactions)); } return(Ok("")); }
/// <summary> /// Get for the reported transactions for a specified account /// </summary> /// <param name="accountId">Id for the account that is being requested</param> /// <param name="startDate">The start date for which to request the transactions</param> /// <param name="endDate">The end date for which to request the transactions</param> /// <returns>A List of the Reported Transactions that is associated on that account between the specified dates</returns> private ActionResult GetReportedTransactions(string accountId, DateTime startDate, DateTime endDate) { ReportedTransaction transaction = new ReportedTransaction(); return(Ok(transaction.GetTransactions(accountId, startDate, endDate))); }