public IActionResult AddWallet(DriverAddWallet driverAddWallet)
 {
     try
     {
         Validator.validateDriverWallet(driverAddWallet);
         DADriver dADriver = new DADriver();
         return(this.OKResponse(dADriver.AddWallet(_context, driverAddWallet, User.ToAppUser()) == true ? "Inserted Successfully" : "Insertion Failed"));
     }
     catch (DataValidationException ex)
     {
         return(this.KnowOperationError(ex.Message));
     }
 }
Exemplo n.º 2
0
 public static void validateDriverWallet(DriverAddWallet driverAddWallet)
 {
     if (driverAddWallet.DriverId == 0)
     {
         throw new DataValidationException($"DriverId does not exists");
     }
     if (driverAddWallet.Transactionid == 0)
     {
         throw new DataValidationException($"Transactionid does not exists");
     }
     if (driverAddWallet.Currencyid == 0)
     {
         throw new DataValidationException($"Currencyid does not exists");
     }
     if (driverAddWallet.Walletamount == 0)
     {
         throw new DataValidationException($"Walletamount does not exists");
     }
 }