示例#1
0
        public IActionResult Deposit(string id)
        {
            var user = this.userService.GetUser(id);

            if (user == null)
            {
                return(NotFound($"Unable to load user with this id."));
            }

            var userModel = new UserDepositViewModel(user);

            return(View(userModel));
        }
示例#2
0
        public IActionResult Deposit(UserDepositViewModel model)
        {
            if (!ModelState.IsValid)
            {
                string id = userManager.GetUserId(User);
                var    u  = this.userService.GetUser(id);
                model.Balance = u.Balance;

                return(View(model));
            }

            var user = this.userService.AddToVallet(model.DepositSum, this.userManager.GetUserId(User));

            if (user == null)
            {
                return(NotFound($"Unable to load user details."));
            }
            var userModel = new UserDepositViewModel(user);

            return(View(userModel));
        }