Esempio n. 1
0
        public async Task <IActionResult> Detail(string customerId)
        {
            if (string.IsNullOrWhiteSpace(customerId))
            {
                throw new ApplicationException("Can't get customer with id null");
            }

            DetailCustomerViewModel model = new DetailCustomerViewModel();

            model.Customer = await _customerService.GetCustomerById(customerId);

            if (model.Customer == null)
            {
                return(RedirectToAction(nameof(ErrorController.Error404), "Error"));
            }

            var size = 3;
            var page = 1;

            model.ListTransactionHistoryModel = await _transactionHistoryService.GetListTransactionHistory(size, page, customerId);

            var dateFrom = DateTime.Now.AddDays(-30).Date;
            var dateTo   = DateTime.Now.Date;

            model.PropertyFluctuations = await _transactionHistoryService.GetPropertyFluctuations(customerId, dateFrom, dateTo);

            model.InvestmentTarget = await _investmentTargetService.GetInvestmentTarget(customerId);

            model.UserPortfolios = await _userService.GetUserPorfolio(customerId);

            return(View(model));
        }
Esempio n. 2
0
        public async Task <IActionResult> Detail()
        {
            if (!_userService.IsSignedIn(User))
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            var currentUser = await _userService.GetCurrentUser();

            DetailCustomerViewModel model = new DetailCustomerViewModel();

            model.Customer = currentUser;

            var dateFrom = DateTime.Now.AddDays(-30).Date;
            var dateTo   = DateTime.Now.Date;

            model.PropertyFluctuations = await _transactionHistoryService.GetPropertyFluctuations(currentUser.Id, dateFrom, dateTo);

            model.InvestmentTarget = await _investmentTargetService.GetInvestmentTarget(currentUser.Id);

            return(View(model));
        }