Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 2.72 KB

File metadata and controls

66 lines (42 loc) · 2.72 KB

Lesson 12: ViewModels, Model Validation, and Enums

In the prep work for this lesson, the students learned:

  1. What ViewModels are and why we should use them.
  2. How and why to validate model data in ASP.NET.
  3. How to use C# validation attributes.
  4. How to employ good error handling when bad data is entered.
  5. What enum data types are and how to write them in C#.

Announcements

  1. Check with your course manager for any important announcements.

NOTE: Lesson 13 is a scheduled work day.

Part-Time Students

  1. Students should have assignment 3 completed by today's class.

Full-Time Students

  • Welcome to Days 19 - 21
  • Assignment 3 Due end of Day 22
  • Day 19:
    • Lesson 12
  • Day 20:
    • Assignment 3 Work Day
  • Day 21:
    • Work Day for Assignment 3
    • Have students review SQL textbook and set up MySQL

Large Group Time (Instructor)

Lesson 12 Topics That Require Careful Attention

  1. You may want to introduce the topic of model validation with a more widely-scoped discussion of data handling:

    a. Why is good data important?

    b. How can bad data be dangerous?

    c. Why would using a ViewModel be beneficial in model validation?

  2. Be sure that the students can differentiate between client and server side validation tools.

  3. Discuss some commonly-used attributes from the C#.

  4. Walk the students through the validation flow mentioned in the text, perhaps with a new sample property on AddEventViewModel from CodingEvents .

  5. Compare strong error message and handling techniques to weaker examples.

  6. Address enum data types:

    a. How to create an enum.

    b. How to add an enum type property onto a class.

    c. What kind of data is handled well with enums.

Small Group Time: Lesson 12 Studio (TA Notes)

  1. Today's studio asks students to add validation for the User model in their spa day application. If they were not able to complete the user signup studio work from the previous class, they will still be able to work on this studio.
  2. Starter code is provided for the students in the LaunchCodeEducation/SpaDay repository. If they have not already added this as an upstream remote repository in addition to their own forked version, they may need to in order to fetch the appropriate starter branch for the studio.
  3. Students are mostly on their own to decide what their form validation should look like, although most of the work resembles the tasks we demonstrate in the in-book CodingEvents examples.
  4. For those students who try the Bonus Mission, try talking with them about the relative merits of each password checking method.