public async Task <bool> ValidateName(TicketSource TicketSource) { if (string.IsNullOrWhiteSpace(TicketSource.Name)) { TicketSource.AddError(nameof(TicketSourceValidator), nameof(TicketSource.Name), ErrorCode.NameEmpty); } else if (TicketSource.Name.Length > 255) { TicketSource.AddError(nameof(TicketSourceValidator), nameof(TicketSource.Name), ErrorCode.NameOverLength); } return(TicketSource.IsValidated); }
public async Task <bool> ValidateId(TicketSource TicketSource) { TicketSourceFilter TicketSourceFilter = new TicketSourceFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = TicketSource.Id }, Selects = TicketSourceSelect.Id }; int count = await UOW.TicketSourceRepository.Count(TicketSourceFilter); if (count == 0) { TicketSource.AddError(nameof(TicketSourceValidator), nameof(TicketSource.Id), ErrorCode.IdNotExisted); } return(count == 1); }