public async Task <IActionResult> RegisterUserResponseAsync(InfoSessionFollowUpResponseSpecDto specDto)
        {
            await _followUpService.ChangeFollowUpStatusAsync(specDto).ConfigureAwait(false);

            if (!_followUpService.ValidationDictionary.GetModelState().IsValid)
            {
                return(BadRequest(new { errors = _followUpService.ValidationDictionary.GetErrorMessages() }));
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task ChangeFollowUpStatusAsync(InfoSessionFollowUpResponseSpecDto specDto)
        {
            if (specDto == default)
            {
                throw new ArgumentNullException(nameof(specDto));
            }

            var currentStatus = await _infoSessionFollowUpRepository.GetStatusByTokenAsync(specDto.Token)
                                .ConfigureAwait(false);

            if (currentStatus == InfoSessionFollowUpStatus.Accepted || currentStatus == InfoSessionFollowUpStatus.Declined)
            {
                ValidationDictionary.AddModelError("FollowUp Status",
                                                   "Organization has already accepted or declined the follow up email");

                return;
            }

            await _infoSessionFollowUpRepository.UpdateStatusAsync(specDto.Token, specDto.IsAccepted?
                                                                   InfoSessionFollowUpStatus.Accepted :
                                                                   InfoSessionFollowUpStatus.Declined).ConfigureAwait(false);
        }