예제 #1
0
        public async Task <Guid> CreateAsync(CancellationToken token)
        {
            var createdModel = await _someModelRepository.CreateAsync(token : token);

            await _someModelRepository.SaveChangesAsync(token);

            _ = Task.Run(async() =>
            {
                createdModel.Status = StateStatus.Running;
                await _someModelRepository.UpdateAsync(createdModel, token);
                await _someModelRepository.SaveChangesAsync(token);

                await Task.Delay(TimeSpan.FromMinutes(2));

                createdModel.Status = StateStatus.Finished;
                await _someModelRepository.UpdateAsync(createdModel, token);
                await _someModelRepository.SaveChangesAsync(token);
            });

            return(createdModel.Id);
        }