Example #1
0
        public async Task <bool> CreateBusinessAccount(BusinessAccountModel model)
        {
            _dbContext.Set <BusinessAccount>().Add(new BusinessAccount
            {
                AccountName   = model.AccountName,
                AccountNumber = model.AccountNumber,
                BankId        = model.BankId,
                BusinessId    = model.BusinessId,
                Comment       = model.Comment
            });

            int count = await _dbContext.SaveChangesAsync();

            return(count > 0);
        }
Example #2
0
        public async Task <bool> UpdateBusinessAccount(BusinessAccountModel model)
        {
            var entity = await _dbContext.Set <BusinessAccount>().FindAsync(model.Id);

            if (entity == null)
            {
                throw new BadRequestException("Business account does not exist");
            }

            entity.AccountName   = model.AccountName;
            entity.AccountNumber = model.AccountNumber;
            entity.BankId        = model.BankId;
            entity.BusinessId    = model.BusinessId;
            entity.Comment       = model.Comment;

            int count = await _dbContext.SaveChangesAsync();

            return(count > 0);
        }