public async Task <bool> ValidateName(TicketGroup TicketGroup) { if (string.IsNullOrWhiteSpace(TicketGroup.Name)) { TicketGroup.AddError(nameof(TicketGroupValidator), nameof(TicketGroup.Name), ErrorCode.NameEmpty); } else if (TicketGroup.Name.Length > 255) { TicketGroup.AddError(nameof(TicketGroupValidator), nameof(TicketGroup.Name), ErrorCode.NameOverLength); } return(TicketGroup.IsValidated); }
public async Task <bool> ValidateStatus(TicketGroup TicketGroup) { if (StatusEnum.ACTIVE.Id != TicketGroup.StatusId && StatusEnum.INACTIVE.Id != TicketGroup.StatusId) { TicketGroup.AddError(nameof(TicketGroupValidator), nameof(TicketGroup.Status), ErrorCode.StatusNotExisted); } return(TicketGroup.IsValidated); }
public async Task <bool> ValidateTicketType(TicketGroup TicketGroup) { if (TicketGroup.TicketType == null) { TicketGroup.AddError(nameof(TicketGroupValidator), nameof(TicketGroup.TicketType), ErrorCode.TicketTypeEmpty); } return(TicketGroup.IsValidated); }
public async Task <bool> ValidateId(TicketGroup TicketGroup) { TicketGroupFilter TicketGroupFilter = new TicketGroupFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = TicketGroup.Id }, Selects = TicketGroupSelect.Id }; int count = await UOW.TicketGroupRepository.Count(TicketGroupFilter); if (count == 0) { TicketGroup.AddError(nameof(TicketGroupValidator), nameof(TicketGroup.Id), ErrorCode.IdNotExisted); } return(count == 1); }