示例#1
0
        public ActionResult AddFunds()
        {
            User     user  = _session.Get <User>(_context.UserId);
            AddFunds funds = Mapper.Map <AddFunds>(user);

            return(View(funds));
        }
示例#2
0
        public ActionResult AddFunds(AddFunds model)
        {
            String id = User.Identity.GetUserId();
            Money  m  = DBContext.Money.Where(x => x.UserID == id).FirstOrDefault();

            m.CurrentAmount += model.Money;
            DBContext.SaveChanges();
            return(Redirect("~/"));
        }
示例#3
0
        public ActionResult ConfirmAddFunds(AddFunds funds)
        {
            if (!ModelState.IsValid)
            {
                return(View(funds));
            }
            if (funds.Wallet >= (decimal)1000.0)
            {
                ModelState.AddModelError(string.Empty, "Error: Wallet amount cannot exceed $999.99");
                return(View(funds));
            }
            User user = _session.Get <User>(_context.UserId);

            using (var txn = _session.BeginTransaction())
            {
                user.Wallet = funds.Wallet;
                _session.SaveOrUpdate(user);
                txn.Commit();
            }
            ModelState.AddModelError(string.Empty, "Funds successfully added!");
            return(View(funds));
        }
示例#4
0
 public void Add([FromBody] AddFunds addFunds)
 {
     _moneyCommands.AddFunds(addFunds.UserId, addFunds.Amount);
 }
 public async Task <IActionResult> AddFunds([FromBody] AddFunds command)
 => await DispatchAsync(command.Bind(c => c.UserId, UserId));
示例#6
0
        public ActionResult AddFunds()
        {
            AddFunds model = new AddFunds();

            return(View(model));
        }