public async Task <TradeHistoryViewModel> GetAllClosedPositionsIntervalByUserIdAsync(string userId, string startDate, string endDate) { var accountResult = await this.accountRepository .All() .Where(a => a.UserId == userId) .Select(a => new { Username = a.User.UserName, Email = a.User.Email, AccountId = a.Id, StartBalance = a.User.StartBalance, Balance = a.Balance, }) .FirstOrDefaultAsync(); int accountId = accountResult.AccountId; var closedPositions = await this.positionsService.GetAccountClosedPositions(accountId, startDate, endDate); var result = new TradeHistoryViewModel { Username = accountResult.Username, Email = accountResult.Email, AccountId = accountResult.AccountId, StartBalance = accountResult.StartBalance, Balance = accountResult.Balance, Positions = closedPositions, StartDate = DateTime.Parse(startDate), }; return(result); }
public ActionResult TradeHistory(int team1, int team2) { if (team1 == 0 || team2 == 0) { return(PartialView("Error")); } var vm = new TradeHistoryViewModel(team1, team2); return(PartialView(vm)); }