Пример #1
0
        private void AddParticipants(string[] input)
        {
            int.TryParse(input[0], out int groupId);
            var part1Ident = input[1];
            var part2Ident = input[2];

            var group = _groupService.LoadGroupById(groupId);

            if (group == null)
            {
                logger.Info($"Unable to find group {input[0]}");
                return;
            }

            var part1 = _participantService.LoadParticipantByName(part1Ident);

            if (part1 == null)
            {
                logger.Info($"Unable to find participant {input[1]}");
                return;
            }

            var part2 = _participantService.LoadParticipantByName(part2Ident);

            if (part2 == null)
            {
                logger.Info($"Unable to find participant {input[2]}");
                return;
            }

            group.Participant1 = part1;
            group.Participant2 = part2;

            _groupService.Update(group);

            logger.Info($"Group successfully updated");
        }