public async Task <DatasetToReadDTO> GetDatasetById(Guid id) { var dataset = await _repository.GetDatasetByIdAsync(id); return(new DatasetToReadDTO { Id = dataset.Id, Name = dataset.Name, Records = dataset.Records.Select(record => new RecordDTO { Inputs = record.Inputs, Output = record.Output }).ToArray() }); }
public async Task <IActionResult> GetAllUsersByDatasetIdAsync(long id) { var dataset = await _datasetRepository.GetDatasetByIdAsync(id); if (dataset == null) { return(NotFound(ResponseResult.Failed(ErrorCode.Error, "Dataset isn't found."))); } var users = await _friendShipRepository.GetAllUniqueUsersWithFriendsCountByDatasetIdAsync(id); var result = new DatasetUsersOutputModel { Dataset = Mapper.Map <DatasetOutputModel>(dataset), Users = Mapper.Map <List <UserOutputModel> >(users) }; return(Ok(ResponseResult.SucceededWithData(result))); }