In Class Work Discussion

#1

For week 1, day 2 we created an empty MVC Core project. You were suppose to use the static built model and output to the view. Several of your implementations were very close to outputting the model into the view. A hint for you, go to page 34 and look at the model binding example on the page. Also look at the the View() parameters that can be passed into the view method. This should help you solve the final issue.

#2

I created a working example of Wk 1 Day 2 in class project.Try to complete on your own before looking at my solution.

https://github.com/carbtin/dotnet-workbook/tree/master/Examples/Wk1Day2_Empty

#3

Add a live database instance example, connecting to a gearhost SQL instance.

https://github.com/carbtin/dotnet-workbook/tree/master/Examples/DatabaseExample

https://github.com/carbtin/dotnet-workbook/tree/master/Examples/MySchool

#4

I understand most of it, but only after looking at your code. Can we go over the Controller code tomorrow? I’m also not sure why we need the code in the View:
@{ Layout = null;
string[] strArr = (string[]) ViewData[“my_arr”];
}

#5

The ViewData is a separate example of passing data from the controller to the view.