public ActionResult AddFunds() { User user = _session.Get <User>(_context.UserId); AddFunds funds = Mapper.Map <AddFunds>(user); return(View(funds)); }
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("~/")); }
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)); }
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));
public ActionResult AddFunds() { AddFunds model = new AddFunds(); return(View(model)); }