示例#1
0
        public async Task <IActionResult> GetDetail(long?id)
        {
            if (id == null)
            {
                return(JsonBadRequest("Data ID is required."));
            }
            var data = await dataRepository.GetDataIncludeAllAsync(id.Value);

            if (data == null)
            {
                return(JsonNotFound($"Data Id {id.Value} is not found."));
            }
            var model = new DetailsOutputModel(data);

            model.Tags = tagLogic.GetAllTags(data.Id).Select(t => t.Name);
            var parent = await preprocessHistoryRepository.GetInputDataAsync(data.Id);

            if (parent != null)
            {
                model.Parent = new IndexOutputModel(parent);
            }
            var children = preprocessHistoryRepository.GetPreprocessIncludePreprocessByInputDataId(data.Id);

            if (children != null & children.Count() > 0)
            {
                model.Children = children.Select(p => new PreprocessHistoryOutputModel(p));
            }
            return(JsonOK(model));
        }
示例#2
0
        public IActionResult GetTags()
        {
            // タグ種別がデータのものに限定する
            var tags = tagLogic.GetAllTags().Where(t => t.Type == TagType.Data);

            return(JsonOK(tags.Select(t => t.Name)));
        }