Beispiel #1
0
        public async Task <IActionResult> PostAsync([FromBody] DataApiModel data)
        {
            if (data == null)
            {
                return(new BadRequestObjectResult("Data is empty"));
            }

            var response = await _faceRepository.Post(data.Data);

            var visioResponse = await _visioRepository.Post(data.Data);

            var visioModel = new VisioModel();

            if (visioResponse.IsSuccessStatusCode)
            {
                visioModel = JsonConvert.DeserializeObject <VisioModel>(visioResponse.ResponseBody);
            }

            var faceModel = new FaceModel();

            if (response.IsSuccessStatusCode)
            {
                faceModel = JsonConvert.DeserializeObject <IList <FaceModel> >(response.ResponseBody).FirstOrDefault();
            }

            var o = new
            {
                Id             = faceModel?.FaceId,
                Description    = visioModel.Description.Captions.FirstOrDefault()?.Text,
                FaceAttributes = faceModel?.FaceAttributes,
                Tags           = visioModel.Tags
            };

            return(new OkObjectResult(o));
        }
        public async Task <IActionResult> Delete([FromBody] DataApiModel data)
        {
            if (data == null)
            {
                return(new BadRequestObjectResult("Data is empty"));
            }

            var response = await _personGroupService.Delete(data.Data);

            if (response.IsSuccessStatusCode)
            {
                return(new OkObjectResult(response.ResponseBody));
            }
            return(new BadRequestObjectResult(response.ResponseStatusCode));
        }
Beispiel #3
0
        public DataApiHelper(Dataset dataset, User user, DataApiModel data, string title, UploadMethod uploadMethod)
        {
            datasetManager          = new DatasetManager();
            userManager             = new UserManager();
            entityPermissionManager = new EntityPermissionManager();
            dataStructureManager    = new DataStructureManager();
            uploadHelper            = new UploadHelper();

            _dataset      = dataset;
            _user         = user;
            _data         = data;
            _title        = title;
            _uploadMethod = uploadMethod;

            _dataStructure = dataStructureManager.StructuredDataStructureRepo.Get(_dataset.DataStructure.Id);
            reader         = new AsciiReader(_dataStructure, new AsciiFileReaderInfo());
        }