Пример #1
0
        public async Task <CharacterInfo> GetOne(int projectId, int characterId)
        {
            var character = await CharacterRepository.GetCharacterViewAsync(projectId, characterId);

            var project = await ProjectRepository.GetProjectWithFieldsAsync(projectId);

            return
                (new CharacterInfo
            {
                CharacterId = character.CharacterId,
                UpdatedAt = character.UpdatedAt,
                IsActive = character.IsActive,
                InGame = character.InGame,
                BusyStatus = (CharacterBusyStatus)character.GetBusyStatus(),
                Groups = ToGroupHeaders(character.DirectGroups),
                AllGroups = ToGroupHeaders(character.AllGroups),
                Fields = GetFields(character, project).Where(field => field.HasViewableValue)
                         .Select(field => new FieldValue
                {
                    ProjectFieldId = field.Field.ProjectFieldId,
                    Value = field.Value,
                    DisplayString = field.DisplayString,
                }),
                PlayerUserId = character.ApprovedClaim?.PlayerUserId,
                CharacterDescription = character.Description,
                CharacterName = character.Name,
            });
        }