Пример #1
0
 public Task <FindCustomerByIdResponse> GetByid(
     [FromServices] IMediator mediator,
     [FromQuery] FindCustomerByIdRequest command
     )
 {
     return(mediator.Send(command));
 }
Пример #2
0
        public CustomerDTO GetCustomerAction(Request request)
        {
            FindCustomerByIdRequest findCustomerByIdRequest = new FindCustomerByIdRequest(Int16.Parse(request.Get("id")));

            Customer Customer = this.findCustomerByIdUseCase.Execute(findCustomerByIdRequest);

            return(this.CustomerConverter.Convert(Customer));
        }
Пример #3
0
        public async Task <IActionResult> GetByid(
            [FromServices] IMediator mediator,
            [FromQuery] FindCustomerByIdRequest command
            )
        {
            var result = await mediator.Send(command);

            return(Ok(result));
        }
        public IActionResult GetById(
            [FromServices] IMediator mediator,
            [FromQuery] FindCustomerByIdRequest command
            )
        {
            var result = mediator.Send(command);

            return(Ok(result));
        }
        public FindCustomerByIdResponse GetCustomerById(FindCustomerByIdRequest command)
        {
            var customer = _context.Customers.AsNoTracking().FirstOrDefaultAsync(x => x.Id == command.Id).Result;

            return(new FindCustomerByIdResponse
            {
                Id = customer.Id,
                Name = customer.Name,
                Email = customer.Email
            });
        }
Пример #6
0
        public Customer Execute(FindCustomerByIdRequest request)
        {
            CustomerId customerId = new CustomerId(request.Id);

            return(this.CustomerRepository.FindById(customerId));
        }