Пример #1
0
        public async Task <IActionResult> OverdraftPayment()
        {
            OverdraftPaymentVM opVM = new OverdraftPaymentVM {
                Accounts         = await _AcctRepo.Get(userManager.GetUserId(User)),
                OverdraftBalance = _UserRepo.Get(userManager.GetUserId(User)).Overdraft,
            };

            return(View(opVM));
        }
Пример #2
0
        public AdminModel AddAdmin(AddAdminDto dto)
        {
            return(ProtectedExecute <AddAdminDto, AdminModel>(adminDto =>
            {
                CheckActiveSuperAdmin(adminDto.SuperAdminSession);

                if (AccountRepo.Get(adminDto.AccountId.GetValueOrDefault()) == null)
                {
                    throw new NotFoundException("Account");
                }

                if (IsAdmin(adminDto.AccountId.GetValueOrDefault()))
                {
                    throw new ConflictException("admin account");
                }

                AdminModel model = Mapper.Map <AddAdminDto, AdminModel>(adminDto);
                return AdminRepo.Create(model);
            }, dto));
        }
Пример #3
0
        public async Task <ActionResult> Edit(int?id)
        {
            AccountViewModel vm = new AccountViewModel();

            if (id != null)
            {
                AccountDto dto = await _accountRepo.Get(id.Value);

                if (dto == null)
                {
                    return(RedirectToAction("Index"));
                }

                vm = Mapper.Map <AccountDto, AccountViewModel>(dto);
            }

            await AddCurrencies(vm);

            return(View(vm));
        }
Пример #4
0
        public async Task <IActionResult> Withdraw(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var termD = await _TermDepositRepo.Get(id);

            if (termD == null)
            {
                return(NotFound());
            }
            TDWithdrawlVM TDWVM = new TDWithdrawlVM {
                Accounts     = await _AcctRepo.Get(UserManager.GetUserId(User)),
                Withdrawn    = termD.Withdrawn,
                maturityDate = termD.DateCreated.AddYears(termD.TermYears)
            };

            return(View(TDWVM));
        }
Пример #5
0
        public async Task <IActionResult> Payment(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var loan = await _loanRepo.Get(id);

            if (loan == null)
            {
                return(NotFound());
            }
            LoanPaymentVM loanPaymentVM = new LoanPaymentVM
            {
                Accounts    = await _AcctRepo.Get(UserManager.GetUserId(User)),
                PaidOff     = loan.PaidOff,
                LoanBalance = loan.Balance,
            };

            return(View(loanPaymentVM));
        }
Пример #6
0
        public OperationResult Edit(EditAccount command)
        {
            var operationResult = new OperationResult();
            var Account         = _accountRepo.Get(command.Id);

            if (Account == null)
            {
                return(operationResult.Failed(ApplicationMessage.recordNotFound));
            }

            if (_accountRepo.Exists(c => (c.Username == command.Username || c.Mobile == command.Mobile) && c.Id != command.Id))
            {
                return(operationResult.Failed(ApplicationMessage.duplicated));
            }

            var path        = $"ProfileImage";
            var Picturepath = _fileUploader.Upload(command.ProfilePicture, path);

            Account.Edit(command.FullName, command.Username, command.Mobile, command.RoleId, Picturepath);

            _accountRepo.Save();
            return(operationResult.Succeeded());
        }
Пример #7
0
        private AccountDto GetClickedAccount(object sender)
        {
            //get button parent until we reach the user control (Editable Item Control)
            DependencyObject ucParent = ((Button)sender).Parent;

            while (!(ucParent is UserControl))
            {
                ucParent = LogicalTreeHelper.GetParent(ucParent);
            }

            // cast to specific type from UserControl
            EditableItemControl userControl = (EditableItemControl)ucParent;

            //Get from Db the account with the id of the UserControl
            AccountDto accountDto = _accountRepo.Get(userControl.Id);

            return(accountDto);
        }
Пример #8
0
 private void Form1_Load(object sender, EventArgs e)
 {
     AccountDto account = _accountRepo.Get(1);
 }
Пример #9
0
        public void Get_ReturnsListOfAccounts()
        {
            var accounts = _accountRepo.Get();

            Assert.True(accounts.Any());
        }
Пример #10
0
 public AccountModel GetInfo(SessionDto dto)
 {
     SessionService.CheckSession(dto);
     return(AccountRepo.Get(dto.UserId.GetValueOrDefault()));
 }
Пример #11
0
        public async Task <IActionResult> Index()
        {
            var accts  = (await _repo.Get()).Where <Account>(a => a.AppUserId == UserManager.GetUserId(User));
            var bAccts = accts.Where(b => b is BusinessAccount);
            var cAccts = accts.Where(c => c is CheckingAccount);

            return(View(new IndexVM {
                Accounts = accts, BusinessAccoutns = bAccts, CheckingAccounts = cAccts
            }));
        }
Пример #12
0
 public List <Account> Get()
 {
     return(_accountRepo.Get());
 }