public CompletionStatus Validate() { //TODO: fluent validation var status = new CompletionStatus(); if (string.IsNullOrEmpty(Name)) { status.AddValidationMessage("Name is Required"); } return(status); }
public async Task <EntityResponse <SatelliteMessageDto> > Handle(AddSatelliteRequest request, CancellationToken cancellationToken) { var completionStatus = new CompletionStatus(); var hasSatelliteInvalid = request.SatelliteList.Any(item => !SatelliteMapper.BuildSatellite(item).Validate().IsSuccessful); var satelliteMessage = new SatelliteMessageDto(); if (!hasSatelliteInvalid) { satelliteMessage = UnitOfWork.SatelliteRepository.FindInformation(request.SatelliteList); } else { completionStatus.AddValidationMessage("The names of the satellites are required "); } var response = new EntityResponse <SatelliteMessageDto> { Entity = satelliteMessage, Status = completionStatus }; return(response); }