public async Task <IActionResult> Post(CreateComponentRequest request) { var componentDto = _mapper.Map <ComponentDto>(request); await _componentService.CreateAsync(componentDto); return(Ok()); }
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);
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()); } }
public async Task <IActionResult> PostComponent(ComponentForCreationDto componentForCreation) { var component = await _componentService.CreateAsync(componentForCreation); return(CreatedAtAction("GetComponent", new { id = component.Id }, component)); }