Ejemplo n.º 1
0
        public async Task <IActionResult> Post(CreateComponentRequest request)
        {
            var componentDto = _mapper.Map <ComponentDto>(request);
            await _componentService.CreateAsync(componentDto);

            return(Ok());
        }
Ejemplo n.º 2
0
 public async Task <Component> CreateComponentAsync(
     [Service] IComponentService service,
     string name,
     [DefaultValue("type Component { text: String! }")] string schema,
     [GraphQLType(typeof(AnyType))] Dictionary <string, object?>?values,
     CancellationToken cancellationToken)
 => await service.CreateAsync(name, schema, values, cancellationToken);
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(Component model)
        {
            try
            {
                await _componentService.CreateAsync(model.Name, model.Price, model.Description, model.Weight);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> PostComponent(ComponentForCreationDto componentForCreation)
        {
            var component = await _componentService.CreateAsync(componentForCreation);

            return(CreatedAtAction("GetComponent", new { id = component.Id }, component));
        }