public bool ValidCreateObject(EmployeeLoanDetail employeeLoanDetail, IEmployeeLoanService _employeeLoanService) { VHasEmployeeLoan(employeeLoanDetail, _employeeLoanService); if (!isValid(employeeLoanDetail)) { return(false); } VIsValidAmount(employeeLoanDetail); if (!isValid(employeeLoanDetail)) { return(false); } VIsValidAmountPaid(employeeLoanDetail); return(isValid(employeeLoanDetail)); }
public bool ValidUpdateObject(EmployeeLoanDetail employeeLoanDetail, IEmployeeLoanService _employeeLoanService) { employeeLoanDetail.Errors.Clear(); ValidCreateObject(employeeLoanDetail, _employeeLoanService); return(isValid(employeeLoanDetail)); }
public EmployeeLoanDetail UpdateObject(EmployeeLoanDetail employeeLoanDetail, IEmployeeLoanService _employeeLoanService) { return(employeeLoanDetail = _validator.ValidUpdateObject(employeeLoanDetail, _employeeLoanService) ? _repository.UpdateObject(employeeLoanDetail) : employeeLoanDetail); }
public EmployeeLoanDetail VHasEmployeeLoan(EmployeeLoanDetail employeeLoanDetail, IEmployeeLoanService _employeeLoanService) { EmployeeLoan employeeLoan = _employeeLoanService.GetObjectById(employeeLoanDetail.EmployeeLoanId); if (employeeLoan == null) { employeeLoanDetail.Errors.Add("EmployeeLoan", "Tidak ada"); } return(employeeLoanDetail); }
public EmployeeLoanDetail CreateObject(EmployeeLoanDetail employeeLoanDetail, IEmployeeLoanService _employeeLoanService) { employeeLoanDetail.Errors = new Dictionary <String, String>(); return(_validator.ValidCreateObject(employeeLoanDetail, _employeeLoanService) ? _repository.CreateObject(employeeLoanDetail) : employeeLoanDetail); }