Exemplo n.º 1
0
        public override async Task <Product> CreateAsync(Product resource)
        {
            var createForm = new CreateForm(ProjectRepository,
                                            ProductDefinitionRepository,
                                            StoreRepository,
                                            UserRolesRepository,
                                            UserRepository,
                                            CurrentUserContext);

            if (!createForm.IsValid(resource))
            {
                throw new JsonApiException(createForm.Errors);
            }

            var product = await base.CreateAsync(resource);

            // TODO: figure out why this throws a NullReferenceException
            // await ProjectRepository.UpdateAsync(result.ProjectId, result.Project);

            if (product != null)
            {
                HangfireClient.Enqueue <WorkflowProductService>(service => service.ManageNewProduct(product.Id));
            }
            return(product);
        }
Exemplo n.º 2
0
        public override async Task <Project> CreateAsync(Project resource)
        {
            var createForm = new CreateForm(UserRepository,
                                            GroupRepository,
                                            CurrentUserContext,
                                            UserRolesRepository,
                                            OrganizationRepository);

            if (!createForm.IsValid(resource))
            {
                throw new JsonApiException(createForm.Errors);
            }
            var project = await base.CreateAsync(resource);

            if (project != null)
            {
                HangfireClient.Enqueue <BuildEngineProjectService>(service => service.ManageProject(project.Id, null));
            }
            return(project);
        }