Ejemplo n.º 1
0
        public async Task AddAsync(SalesTaxAddModel model)
        {
            var result = await _bankAccountRepository.getAccountTypeByCode();

            var bankAcc = SalesTaxFactory.AccountCreate(model, _userId, result.KeyInt);
            await _bankAccountRepository.AddAsync(bankAcc);

            await _unitOfWork.SaveChangesAsync();

            await _repository.AddAsync(SalesTaxFactory.Create(model, _userId, bankAcc.Id));

            await _unitOfWork.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public static SalesTax Create(SalesTaxAddModel addModel, string userId, int accId)
        {
            var salesTax = new SalesTax
            {
                Code          = addModel.Code,
                Description   = addModel.Description,
                TaxPercentage = addModel.TaxPercentage,
                CreatedBy     = userId,
                CreatedOn     = Utilities.Utility.GetDateTime(),
                Status        = Utilities.Constants.RecordStatus.Active,
                BankAccountId = accId
            };

            return(salesTax);
        }
Ejemplo n.º 3
0
        public static BankAccount AccountCreate(SalesTaxAddModel model, string userId, int typeId)
        {
            BankAccount bankAccount = new BankAccount
            {
                AccountHolderName = model.Code,
                Status            = Constants.RecordStatus.Active,
                CreatedBy         = userId ?? "0",
                CreatedOn         = Utility.GetDateTime(),
                AccountCode       = model.Code,
                COA_AccountTypeId = typeId,
                Description       = model.Code,
                LedgerType        = 3,
                AccountName       = model.Code,
                AccountId         = model.Code
            };

            return(bankAccount);
        }
Ejemplo n.º 4
0
 public async Task <IActionResult> Add([FromBody] SalesTaxAddModel model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState.GetErrorList()));
     }
     if (await _manager.IsCodeExistsAsync(model.Code))
     {
         return(BadRequest("Sales tax of this code is already exists"));
     }
     try
     {
         await _manager.AddAsync(model);
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
     return(Ok());
 }