Exemplo n.º 1
0
        public async Task <DatasetClusteringDto> CreateAndClusterDataset(
            string datasetName,
            string datasetDescription,
            string[] texts,
            int userId)
        {
            var datasetTexts = ToDatasetTexts(texts);

            var dataset = new Dataset
            {
                CreatedById = userId,
                Description = datasetDescription,
                Name        = datasetName,
                Texts       = datasetTexts
            };

            DatasetClustering result = await _algorithmService.GetClusteringResult(dataset);

            result.CreatedById = userId;

            await _dbContext.AddAsync(result);

            await _dbContext.SaveChangesAsync();

            var saved = await GetAll(userId, dataset.Id);

            return(saved.Single());
        }
Exemplo n.º 2
0
        public async Task <User> Register(User user)
        {
            await _dbContext.Users.AddAsync(user);

            await _dbContext.SaveChangesAsync();

            return(user);
        }