public async Task <IActionResult> Post([FromBody] AddNewCustomerGroupRequest request) { AddNewCustomerGroupResponse result = await _CustomerGroupAppService.addNewCustomerGroup(request); if (result.Success) { return(Ok(result)); } return(NotFound(result)); }
public Task <AddNewCustomerGroupResponse> addNewCustomerGroup(AddNewCustomerGroupRequest request) { AddNewCustomerGroupCommand command = new AddNewCustomerGroupCommand(request.Name); Task <object> CustomerGroup = (Task <object>)Bus.SendCommand(command); //RabbitMQBus.Publish(command); AddNewCustomerGroupResponse response = new AddNewCustomerGroupResponse(); response = Common <AddNewCustomerGroupResponse> .checkHasNotification(_notifications, response); if (response.Success) { CustomerGroupModel CustomerGroupModel = (CustomerGroupModel)CustomerGroup.Result; response.Data = CustomerGroupModel.ID; } return(Task.FromResult(response)); }