public async Task <bool> ValidateContent(CallLog CallLog) { if (string.IsNullOrWhiteSpace(CallLog.Content)) { CallLog.AddError(nameof(CallLogValidator), nameof(CallLog.Content), ErrorCode.ContentEmpty); } else if (CallLog.Content.Length > 255) { CallLog.AddError(nameof(CallLogValidator), nameof(CallLog.Content), ErrorCode.ContentOverLength); } return(CallLog.IsValidated); }
public async Task <bool> ValidateAppUser(CallLog CallLog) { if (CallLog.AppUser == null) { CallLog.AddError(nameof(CallLogValidator), nameof(CallLog.AppUser), ErrorCode.AppUserEmpty); } return(CallLog.IsValidated); }
public async Task <bool> ValidateCallType(CallLog CallLog) { if (CallLog.CallType == null) { CallLog.AddError(nameof(CallLogValidator), nameof(CallLog.CallType), ErrorCode.CallTypeEmpty); } return(CallLog.IsValidated); }
public async Task <bool> ValidateId(CallLog CallLog) { CallLogFilter CallLogFilter = new CallLogFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = CallLog.Id }, Selects = CallLogSelect.Id }; int count = await UOW.CallLogRepository.Count(CallLogFilter); if (count == 0) { CallLog.AddError(nameof(CallLogValidator), nameof(CallLog.Id), ErrorCode.IdNotExisted); } return(count == 1); }