private void SetNewsletterSubscribtionStatus(BaseCustomerDto customerDto, IEnumerable <string> allNewsletterCustomerEmail = null) { if (customerDto == null || string.IsNullOrEmpty(customerDto.Email)) { return; } if (allNewsletterCustomerEmail == null) { allNewsletterCustomerEmail = GetAllNewsletterCustomersEmails(); } if (allNewsletterCustomerEmail != null && allNewsletterCustomerEmail.Contains(customerDto.Email.ToLowerInvariant())) { customerDto.SubscribedToNewsletter = true; } }
public async Task <IActionResult> RegisterCustomer([FromBody] BaseCustomerDto customerDto) { switch (customerDto.ApplicationType) { case ApplicationType.MrGreen: await _mediator.Send(CommandMapper.CreateCommand(customerDto as MrGreenCustomerDto)); break; case ApplicationType.RedBet: await _mediator.Send(CommandMapper.CreateCommand(customerDto as RedBetCustomerDto)); break; default: return(BadRequest($"{customerDto.ApplicationType} - Application Type is not supported")); } return(StatusCode((int)HttpStatusCode.Created)); }