Exemple #1
0
        private async Task <PurchaseAssetDto> PopulateDTOAsync(PurchaseAssetDto DTO, int id)
        {
            var viewModel = await this.assetService.FindById(id);

            DTO.ViewModel            = viewModel;
            DTO.CurrentClientBalance =
                await ClientHelper.GetUserBalance(this.User.Identity.Name, this.userManager);

            return(DTO);
        }
Exemple #2
0
        public async Task <IActionResult> PurchaseConfirm(int id, PurchaseAssetDto DTO)
        {
            if (!this.ModelState.IsValid)
            {
                await this.PopulateDTOAsync(DTO, id);

                return(this.View(ViewNameConstants.Purchase, DTO));
            }

            await this.assetService.PurchaseAssetAsync(DTO.BindingModel, this.User.Identity.Name);

            string clientId = await ClientHelper.
                              GetUserIdAsync(this.User.Identity.Name, this.userManager);

            return(this.RedirectToAction(ActionConstants.Success, ControllerConstants.Assets));
        }
Exemple #3
0
        public async Task <IActionResult> Purchase(int id, PurchaseAssetDto DTO)
        {
            await this.PopulateDTOAsync(DTO, id);

            return(View(DTO));
        }