public static Specification CreateSpecificationFrom(CreateSpecificationCommand command) { var groups = command.Groups.Select(CreateSpecificationGroupFrom); var dimension = new Specification(command.LeafCategoryId, groups); return(dimension); }
public async Task <IActionResult> Create(CreateSpecificationCommand command) { var id = 0; _eventListener.Subscribe(new ActionHandler <EntityCreated>(a => { id = a.Id; })); await _bus.Dispatch(command); return(Ok(id)); }
public async Task WhenISubmitTheSpecification() { var leafCategoryId = ScenarioContext.Get <int>("leaf-category-Id"); var command = new CreateSpecificationCommand { LeafCategoryId = leafCategoryId, Groups = new List <SpecificationGroupCommand> { new SpecificationGroupCommand() { Title = "Features", Items = new List <SpecificationItemCommand> { new SpecificationItemCommand { Title = "Frame Material", SpecificationItemValueType = 5, Options = new List <string> { "Metal", "Solid Wood", "Manufactured Wood" } }, new SpecificationItemCommand { Title = "Weight Capacity (Queen Size)", SpecificationItemValueType = 3, Options = new List <string>() }, new SpecificationItemCommand { Title = "Mattress Included", SpecificationItemValueType = 2, Options = new List <string>() }, } }, new SpecificationGroupCommand() { Title = "Assembly", Items = new List <SpecificationItemCommand> { new SpecificationItemCommand { Title = "Level of Assembly", SpecificationItemValueType = 1, Options = new List <string>() }, new SpecificationItemCommand { Title = "Adult Assembly Required", SpecificationItemValueType = 2, Options = new List <string>() }, } } } }; ScenarioContext.Add("specification", command); await _specificationTask.CreateSpecification(command); }
internal async Task <int> CreateSpecification(CreateSpecificationCommand command) { var response = await _httpClient.Post <CreateSpecificationCommand, int>("api/specifications", command); return(response); }
public async Task <ActionResult <SpecificationViewModel> > CreateSpecificationAsync(CreateSpecificationCommand createSpecificationCommand) { var existingCategory = await _categoryQueries.FindByIdAsync(createSpecificationCommand.CategoryId); if (existingCategory == null) { return(NotFound()); } var specification = _mapper.Map <Specification>(createSpecificationCommand); await _behavior.CreateSpecificationAsync(specification); var specificationViewModel = await _queries.FindByIdAsync(specification.Id); return(specificationViewModel); }