Пример #1
0
        public async Task <int> CreateAsync([FromBody] ChangeProductDto dto)
        {
            var command = new CreateProductCommand {
                Dto = dto
            };
            await _commandDispatcher.SendAsync(command);

            return(command.Id);
        }
Пример #2
0
 public async Task UpdateAsync(
     int id,
     [FromBody] ChangeProductDto dto,
     [FromServices] IRequestHandler <UpdateProductCommand> handler
     )
 {
     var result = await handler.HandleAsync(new UpdateProductCommand()
     {
         Dto = dto, Id = id
     });
 }
Пример #3
0
        public async Task <int> CreateAsync(
            [FromBody] ChangeProductDto dto,
            [FromServices] IRequestHandler <CreateProductCommand, int> handler)
        {
            var id = await handler.HandleAsync(new CreateProductCommand()
            {
                Dto = dto
            });

            return(id);
        }
Пример #4
0
 public Task UpdateAsync(int id, [FromBody] ChangeProductDto dto)
 {
     return(_commandDispatcher.SendAsync(new UpdateProductCommand {
         Id = id, Dto = dto
     }));
 }
Пример #5
0
 public Task <int> CreateAsync([FromBody] ChangeProductDto dto)
 {
     return(_handlerDispatcher.SendAsync(new CreateProductCommand {
         Dto = dto
     }));
 }
Пример #6
0
 public async Task UpdateAsync(int id, [FromBody] ChangeProductDto dto)
 {
     await _productService.UpdateEntityAsync(id, dto);
 }
Пример #7
0
 public async Task <int> CreateAsync([FromBody] ChangeProductDto dto)
 {
     return(await _productService.CreateEntityAsync(dto));
 }
Пример #8
0
 public Task UpdateAsync(int id, [FromBody] ChangeProductDto dto)
 {
     return(_productService.UpdateAsync(id, dto));
 }
Пример #9
0
 public Task <int> CreateAsync([FromBody] ChangeProductDto dto)
 {
     return(_productService.CreateAsync(dto));
 }