Exemplo n.º 1
0
        private void ValidateRequest(RegisterDonationRequest request)
        {
            _logger.LogDebug("Validating request");

            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (string.IsNullOrWhiteSpace(request.FirstName))
            {
                throw DonationException.InvalidDonorName(nameof(request.FirstName), request.FirstName);
            }

            if (string.IsNullOrWhiteSpace(request.LastName))
            {
                throw DonationException.InvalidDonorName(nameof(request.LastName), request.LastName);
            }

            if (string.IsNullOrWhiteSpace(request.PostCode))
            {
                throw DonationException.InvalidPostcode(request.PostCode);
            }
        }