Hi Jamie 
There seems to a lot going on here.
Since it looks like you’re using Umbraco 13, I would highly recommend you do not develop new features based on the old “Macro” system.
As stated on the documentation for them indicates that they’re being removed very soon.
“Macros and Partial View Macros will be removed in the next version. Consider using Partial Views or Blocks in Rich Text Editor.”
If you want to build pages dynamically as an editor, then I would advise you to look into building Block Lists or Block Grids.
These property editor will require some development knowledge, but should be compatible with many newer versions of Umbraco.
You can probably reuse some if not most of your existing razor code (The HTLM with the BeginUmbraoForm
).
When building UI in Umbraco, you should aim to place all .cshtml
files directly in the “Views” folder or a given sub-folder, based on which type of template it represents.
An example of this is a Block List component which should be place in Views-->Partials-->blocklist-->Components
As for the C# code, you would generally name the files, (eg. myclass.cs
) the same as the class name inside the file.
Now looking at your code, it seems like you make a C# Controller, which ideally should be place in a “Controllers” or “Api” folder for better clarity.
This however, is not a requirement.
Another thing that isn’t necessarily a requirement is the namespace
of the class.
I can see this is not following your project structure, which can cause confusion and problems that are hard to debug.
Namespaces in C# should generally follow the project->folder structure.
See these two example, one for a top level class and one in a sub-folder:
I know I didn’t directly answer your question or provide a solution, but I would really encourage you to consider not using Macros or adding components etc. to the Rich Text Editor(RTE).
Regards
Seb