[HttpPost, Route("register")] // , AmigoTenantClaimsAuthorize(ActionCode = ConstantsSecurity.ActionCode.HouseCreate)] public async Task <ResponseDTO> Register(RegisterHouseRequest house) { if (ModelState.IsValid) { return(await _houseApplicationService.RegisterHouseAsync(house)); } return(ModelState.ToResponse()); }
public async Task <ResponseDTO> RegisterHouseAsync(RegisterHouseRequest newHouse) { //Map to Command var command = _mapper.Map <RegisterHouseRequest, RegisterHouseCommand>(newHouse); //Execute Command var resp = await _bus.SendAsync(command); return(ResponseBuilder.Correct(resp, command.HouseId, command.Code)); //return resp.ToResponse(); }