public async Task <ActionResult> Put(Guid id, [FromBody] UpdateComponentCommand command) { command.Id = id; var result = await _componentService.Update(command); return(Ok(result)); }
public async Task <Component> Update(UpdateComponentCommand command) { var component = new Component { Id = Guid.Parse(command.Id), Name = command.Name, Amount = command.Amount }; await _componentRepository.Update(component); return(component); }
public async Task <Component> Update(UpdateComponentCommand command) { var component = new Component { Id = command.Id, Name = command.Name, Brand = command.Brand, Description = command.Description, ImagePath = command.ImagePath, Price = command.Price, Amount = command.Amount, Type = command.Type }; //am pus // await _componentRepository.RemoveComponent(command.Id); //pana aici await _componentRepository.Update(component); return(component); }
public async Task <ActionResult <ComponentResource> > UpdateComponentAsync([FromRoute] int id, UpdateComponentCommand componentCommand) { componentCommand.Id = id; var componentResource = await _mediator.Send(componentCommand); if (componentResource == null) { return(NotFound()); } return(componentResource); }