public IActionResult EditBonus(DriverBonusInfo driverBonusInfo)
 {
     try
     {
         Validator.validateDriverBonus(driverBonusInfo);
         DADriver dADriver = new DADriver();
         return(this.OKResponse(dADriver.EditBonus(_context, driverBonusInfo, User.ToAppUser()) == true ? "Updated Successfully" : "Updation Failed"));
     }
     catch (DataValidationException ex)
     {
         return(this.KnowOperationError(ex.Message));
     }
 }
예제 #2
0
 public static void validateDriverBonus(DriverBonusInfo driverBonusInfo)
 {
     if (driverBonusInfo.Driverid == 0)
     {
         throw new DataValidationException($"DriverId does not exists");
     }
     if (driverBonusInfo.DriverFineId == 0)
     {
         throw new DataValidationException($"DriverFineId does not exists");
     }
     if (driverBonusInfo.Amount == 0)
     {
         throw new DataValidationException($"Amount does not exists");
     }
     if (string.IsNullOrEmpty(driverBonusInfo.Reason))
     {
         throw new DataValidationException($"Reason does not exists");
     }
 }