/// <summary> /// Retrieve the branch by the specified code /// </summary> /// <param name="code"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <ApiResponse <BranchResponse> > GetBranchByCodeAsync(string code, CancellationToken cancellationToken = default) { var responseModel = new ApiResponse <BranchResponse>(); var branch = await _branchRepo.FindByCodeAsync(code); if (branch == null) { responseModel.AddError(ExceptionCreator.CreateNotFoundError(nameof(branch), $"branch code: {code} not found")); return(responseModel); } var address = await _addressRepo.FindByIdAsync(branch.AddressId); responseModel.Data = CreateBranchResponse(branch, address); return(responseModel); }