public IActionResult EditFine(DriverFineInfo driverFineInfo) { try { Validator.validateDriverFine(driverFineInfo); DADriver dADriver = new DADriver(); return(this.OKResponse(dADriver.EditFine(_context, driverFineInfo, User.ToAppUser()) == true ? "Updated Successfully" : "Updation Failed")); } catch (DataValidationException ex) { return(this.KnowOperationError(ex.Message)); } }
public static void validateDriverFine(DriverFineInfo driverFineInfo) { if (driverFineInfo.Driverid == 0) { throw new DataValidationException($"DriverId does not exists"); } if (driverFineInfo.Currencyid == 0) { throw new DataValidationException($"Currencyid does not exists"); } if (driverFineInfo.DriverFineId == 0) { throw new DataValidationException($"DriverFineId does not exists"); } if (driverFineInfo.Fineamount == 0) { throw new DataValidationException($"Fineamount does not exists"); } if (string.IsNullOrEmpty(driverFineInfo.Fine_reason)) { throw new DataValidationException($"Fine_reason does not exists"); } }