コード例 #1
0
        public IActionResult Create(AccountInfo account)
        {
            Random rand = new Random();
            int    id   = rand.Next(10, 1000);

            account.ClientId = id;
            _account.AddAccount(account);
            return(View("Success", account));
        }
コード例 #2
0
        public IActionResult Post([FromBody] Account account)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            accountRepository.AddAccount(account);

            return(StatusCode(StatusCodes.Status201Created));
        }
コード例 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            decimal startBalance;
            var     chosenClient = clientCombo.SelectedItem as Client;

            if (decimal.TryParse(balanceBox.Text, out startBalance) && chosenClient != null)
            {
                IAccount acc = Factory.Instance.GAccount();
                acc.AddAccount(chosenClient.Id, startBalance);
                UpdateAccount?.Invoke();
                balanceBox.Text          = null;
                clientCombo.SelectedItem = null;
                MessageBox.Show("You've successfully added a new account");
            }
            else
            {
                MessageBox.Show("Invalid input data");
            }
        }
コード例 #4
0
 public IActionResult Add(AccountViewModel accountViewModel)
 {
     try
     {
         var result = _accountService.AddAccount(accountViewModel);
         if (result != null)
         {
             ViewBag.msg = "Done";
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.msg = "Failed";
             return(View("Add", accountViewModel));
         }
     }
     catch
     {
         ViewBag.msg = "Failed";
         return(View("Add", accountViewModel));
     }
 }
コード例 #5
0
 public async Task <ServiceResponse <Account> > AddAccount(Account account)
 {
     return(await _account.AddAccount(account));
 }