Esempio n. 1
0
        public override async Task <Guid> Create(ContextPrincipal principal, Organization organization)
        {
            organization.Id         = Guid.NewGuid();
            organization.CreatedBy  = principal.UserId;
            organization.ModifiedBy = principal.UserId;

            await base.InsertAncestors(organization, Entity.RootId);

            VFileSystemItem folder = new VFileSystemItem {
                Id           = Guid.NewGuid(),
                Title        = organization.Title,
                CreatedBy    = principal.UserId,
                ModifiedBy   = principal.UserId,
                DateCreated  = DateTime.UtcNow,
                DateModified = DateTime.UtcNow,
                Deleted      = false,
                Type         = EVItemType.Folder
            };

            await base.InsertAncestors(folder, organization.Id);

            _unitOfWork.EntityResourceRepository.Insert(organization);
            organizationUnitOfWork.VFileSystemItemRepository.Insert(folder);

            int persistedObjects = await _unitOfWork.Save();

            if (persistedObjects <= 0)
            {
                throw new InvalidOperationException(@"No DB records have been persisted!");
            }

            return(organization.Id);
        }
Esempio n. 2
0
        public async Task <IActionResult> PostQC(Guid id, [FromBody] MetadataTaskBizModel value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ErrorResponse()
                                  .AddModelStateErrors(ModelState)));
            }

            VFileSystemItem file = _mockData[0]; //await _fileService.Get(_principal, id); //

            //value.Id = await _taskService.Create(_principal,
            //        _mapper.Map<TaskModel>(value), id);

            ITasksProcessorActor tasksProcessor = _orleansClient.GetGrain <ITasksProcessorActor>(Guid.Empty);

            //bool succeeded = await tasksProcessor.ScheduleTranscode(file.Location, transcoded + "." + value.Format, value.Format);
            await tasksProcessor.ScheduleQualityControl(file.Location);

            return(CreatedAtAction(nameof(GetFileById), new { id = value.Id }, value));
        }
Esempio n. 3
0
        public async Task <IActionResult> PostTranscoder(Guid id, [FromBody] TranscoderTaskBizModel value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ErrorResponse()
                                  .AddModelStateErrors(ModelState)));
            }

            VFileSystemItem file     = _mockData[0]; //await _fileService.Get(_principal, id); //
            string          location = ConfigUtils.ConfigurationProvider
                                       .GetDefaultConfig()
                                       .GetSection("Storage").GetValue <string>("TranscoderLocation");
            //value.Id = await _taskService.Create(_principal,
            //        _mapper.Map<TaskModel>(value), id);

            ITasksProcessorActor tasksProcessor = _orleansClient.GetGrain <ITasksProcessorActor>(Guid.Empty);

            string transcoded = Path.Combine(location, file.Id.ToString());

            bool succeeded = await tasksProcessor.ScheduleTranscode(file.Location, transcoded + "." + value.Format, value.Format);

            return(CreatedAtAction(nameof(GetFileById), new { id = value.Id }, value));
        }