Exemplo n.º 1
0
 public Task <object> Handle(UpdateProductRequestCommand command, CancellationToken cancellationToken)
 {
     if (!command.IsValid())
     {
         NotifyValidationErrors(command);
     }
     else
     {
         Entities.ProductRequest ProductRequest = new Entities.ProductRequest
                                                  (
             new Identity((uint)command.Id),
             null,
             null,
             null,
             new Status(command.Status),
             new Response(command.Response),
             null
                                                  );
         bool result = _ProductRequestRepository.Update(ProductRequest);
         if (!result)
         {
             _bus.RaiseEvent(new DomainNotification("ProductRequest", "Server error", NotificationCode.Error));
         }
         return(Task.FromResult(result as object));
     }
     return(Task.FromResult(null as object));
 }
Exemplo n.º 2
0
        public Task <UpdateProductRequestResponse> updateProductRequest(UpdateProductRequestRequest request)
        {
            UpdateProductRequestCommand command = new UpdateProductRequestCommand
                                                  (
                request.Id,
                request.response,
                (int)StatusProductRequest.DaXuLy
                                                  );
            Task <object> ProductRequest          = (Task <object>)Bus.SendCommand(command);
            UpdateProductRequestResponse response = new UpdateProductRequestResponse();

            response = Common <UpdateProductRequestResponse> .checkHasNotification(_notifications, response);

            if (response.Success)
            {
                response.Data = (bool)ProductRequest.Result;
            }
            return(Task.FromResult(response));
        }