public async Task IncreaseShiftCountAsync(TestingPersonnelInvitationIncreaseShiftSpecDto specDto)
        {
            if (specDto == null)
            {
                throw new ArgumentNullException(nameof(specDto));
            }

            var doesInvitationExist = await _testingPersonnelInvitationsRepository.AnyAsync(i => i.Id == specDto.InvitationId)
                                      .ConfigureAwait(false);

            if (!doesInvitationExist)
            {
                ValidationDictionary
                .AddModelError("The invitation was not found", $"The invitation was not found");
                return;
            }

            await _testingPersonnelInvitationsRepository.IncreaseShiftCountAsync(specDto.InvitationId, specDto.ShiftNumber, capacityToAdd)
            .ConfigureAwait(false);
        }
示例#2
0
        public async Task <ActionResult> IncreaseShiftCountAsync([FromBody] TestingPersonnelInvitationIncreaseShiftSpecDto specDto)
        {
            if (specDto == null)
            {
                return(BadRequest());
            }

            await _testingPersonnelInvitationsService
            .IncreaseShiftCountAsync(specDto)
            .ConfigureAwait(false);

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

            return(Ok());
        }