I am creating my first MVC website. On the site, I need to create a page that allows a user to choose from a object stored in my model database, enter some additional data (in text fields), and then click a button and do a calculation returning a table of results. These results will not be stored in the database. Also, this table of data could change in the number of columns etc that are turned based on what object is chosen.
What is the best way to do this with MVC? It is not a standard CRUD operation and all of the MVC tutorials I have research only really cover CRUD operations.
ASP.NET MVC pages can be strongly typed to any class (including .Net classes) or non-typed at all, that’s not big deal.
In your place, I’d use a
DataTableobject (from System.Data). You could also sign a struct or pass a list of dictionaries to the view, but lets be practical.Your action (at the controller):
And your view:
Regards