예제 #1
0
        public async Task <bool> ValidateCreateAsync(CreateSubscriberDto model)
        {
            model.CheckArgumentIsNull(nameof(model));

            //if (string.IsNullOrWhiteSpace(model.Name))
            //    throw new ArgumentNullException(nameof(model.Name));

            if (string.IsNullOrWhiteSpace(model.Email))
            {
                throw new ArgumentNullException(nameof(model.Email));
            }

            var subscriber = await _repository.FindByEmailAsync(model.Email);

            if (subscriber != null)
            {
                throw new SubscriptionEmailExistException();
            }

            return(await Task.FromResult(true));
        }