private async Task <bool> ValidateDate(CustomerLeadActivity CustomerLeadActivity) { if (CustomerLeadActivity.FromDate == DateTime.MinValue) { CustomerLeadActivity.AddError(nameof(CustomerLeadActivityValidator), nameof(CustomerLeadActivity.FromDate), ErrorCode.FromDateEmpty); } else { if (CustomerLeadActivity.ToDate.HasValue) { if (CustomerLeadActivity.ToDate.Value <= CustomerLeadActivity.FromDate) { CustomerLeadActivity.AddError(nameof(CustomerLeadActivityValidator), nameof(CustomerLeadActivity.ToDate), ErrorCode.ToDateInvalid); } } } return(CustomerLeadActivity.IsValidated); }
public async Task <bool> ValidateId(CustomerLeadActivity CustomerLeadActivity) { CustomerLeadActivityFilter CustomerLeadActivityFilter = new CustomerLeadActivityFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = CustomerLeadActivity.Id }, Selects = CustomerLeadActivitySelect.Id }; int count = await UOW.CustomerLeadActivityRepository.Count(CustomerLeadActivityFilter); if (count == 0) { CustomerLeadActivity.AddError(nameof(CustomerLeadActivityValidator), nameof(CustomerLeadActivity.Id), ErrorCode.IdNotExisted); } return(count == 1); }