Ejemplo n.º 1
0
 public async Task <bool> SaveBankAccount(BankAccountVM bankAccountVM)
 {
     try
     {
         var bankAccount = MapToDBModel(bankAccountVM);
         if (bankAccount == null)
         {
             return(false);
         }
         return(await _bankAccountService.SaveBankAccount(bankAccount));
     }
     catch (Exception)
     {
         //Error handle
         return(false);
     }
 }
Ejemplo n.º 2
0
 private BankAccount MapToDBModel(BankAccountVM bankAccountVM)
 {
     try
     {
         return(new BankAccount()
         {
             ID = !string.IsNullOrEmpty(bankAccountVM.ID) ? int.Parse(bankAccountVM.ID) : 0,
             UserID = bankAccountVM.UserID,
             CompanyID = bankAccountVM.CompanyID,
             BankName = bankAccountVM.BankName,
             BankBranch = bankAccountVM.BankBranch,
             AccountNumber = bankAccountVM.AccountNumber
         });
     }
     catch (Exception)
     {
         //Error handle
         return(null);
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> SaveBankAccount(string userId, [FromBody] BankAccountVM bankAccount)
        {
            try
            {
                if (userId != bankAccount.UserID || _jwtHelper.GetUserId() != userId || !ModelState.IsValid)
                {
                    return(BadRequest());
                }

                var saveResponse = await _bankAccountMap.SaveBankAccount(bankAccount);

                if (saveResponse)
                {
                    return(NoContent());
                }
            }
            catch (Exception)
            {
                //Error handle
            }
            return(StatusCode(500));
        }
Ejemplo n.º 4
0
 protected override void InsertNew()
 {
     EditVM       = new BankAccountVM();
     IsInEditMode = true;
 }