Beispiel #1
0
        internal async Task <ActionResult <UserAccountsViewModel> > CreateAccount(UserAccountsViewModel model)
        {
            _context.Accounts.Add(model);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        internal async Task <ActionResult> CreateCommission(CommissionsViewModel model)
        {
            _context.Commissions.Add(model);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        internal async Task <ActionResult> CreateAccountCommissions(Account_Has_Commissions model)
        {
            _context.Account_Has_Commissions.Add(model);
            await _context.SaveChangesAsync();

            return(Ok());
        }
Beispiel #4
0
        internal async Task <ActionResult <UsersViewModel> > Register(UsersViewModel userModel)
        {
            //create here an instance of the account service
            _accountService = new AccountService(_context, _configuration);
            _context.Users.Add(userModel);
            await _context.SaveChangesAsync();

            //create the account for the user
            _accountService.CreateAccountFromRegister(userModel.Dni);
            return(Ok());
        }
Beispiel #5
0
        internal async Task <ActionResult> DeleteOper(OperationsViewModel model)
        {
            _context.Operations.Remove(model);
            await _context.SaveChangesAsync();

            account = await _accountService.findAccountToUpdateById(model.AccountId);

            if (model.Concept.Equals("Entrada"))
            {
                account.Balance -= model.Amount;
            }
            else
            {
                account.Balance += model.Amount;
            }
            await _accountService.updateAccount(account);

            return(Ok());
        }