Question: Enhance the website to include forms that allow you to make and edit students, instructors, and courses. The Student entry page should also allow students
Enhance the website to include forms that allow you to make and edit students, instructors, and courses. The Student entry page should also allow students to register for existing courses. The entry forms can be placed on the same screen as the existing pages that show the list of students, instructors, and courses, or they can be added on new pages.
Use Entity Framework Core migrations to take the classes for students, instructors, and courses and make a database. Since students can enroll in multiple courses and courses can hold multiple students, this is a many-to-many relationship. You'll need to define a class and table called StudentCourse that holds records linking students to courses. Use LINQ to generate a list of Students for each course and display it in the modal dialog you developed in Assignment 1.
You do not need to add validation at this point to the front-end, but you should have validation on the back-end that prevents bad data from entering the database. Define a data access layer that can do validation and error-handling.
Your application should also use DTOs between the data layer and the controller rather than passing around the actual database entity classes. I am attaching the codes that should be enhanced.

//Controllers CoursesController.cs using Microsoft.AspNetCore.Mvc; using Register Now_.Models; namespace Register Now_. Controllers public class CoursesController Controller { { public IActionResult Index() var courses = new List { new Course { CourseId = "Hum1", CourseNumber = "303", CourseName = "Humanities", Description = "Exciting Humanities!" }, new Course { CourseId = "Scil", CourseNumber = "203", CourseName = "Science", Description = "Exciting Science!" }, new Course { CourseId = "Eng1", CourseNumber = "101", CourseName = "English", Description = "Exciting English!" }, new Course { CourseId = "Dan1", CourseNumber = "401", CourseName = "Dance", Description = "Exciting Dance!" }, new Course { CourseId = "SocStu1", CourseNumber = "105", CourseName = "Social Studies", Description = "Exciting Social Studies!" } }; } return View(courses); } } HomeController using Microsoft.AspNetCore.Mvc; using RegisterNow_.Models; using System.Diagnostics; namespace Register Now_. Controllers { { public class HomeController Controller private readonly I Logger _logger; public HomeController (ILogger logger) { _logger = logger; } public IActionResult Index() { return View(); } public IActionResult Privacy() { return View(); } [ResponseCache (Duration = 0, Location = ResponseCacheLocation. None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext. TraceIdentifier }); } } InstructorsController using Microsoft.AspNetCore.Mvc; using Register Now_.Models; namespace Register Now_.Controllers public class Instructors Controller Controller { { public IActionResult Index() { var instructors = new List { new Instructor { Id = 1, LastName = "Macaraeg", FirstName = "Emmanuel", Email = "em@gmail.com", Teaches Course = "Humanities" }, new Instructor { Id = 2, LastName = "Sulangi", FirstName = "Arnel", Email = "as@gmail.com", Teaches Course = "Science" }, new Instructor { Id = 3, LastName = "Siasat", FirstName = "Mean", Email = "ms@gmail.com", Teaches Course = "English" }, new Instructor { Id = 4, LastName = "Florendo", FirstName = "Ofelia", Email = "of@gmail.com", Teaches Course = "Dance" }, new Instructor { Id = 5, LastName = "Mendoza", FirstName = "Catalina", Email = "cm@gmail.com", TeachesCourse = "Social Studies" } }; return View(instructors); } } StudentsController using Microsoft.AspNetCore.Mvc; using Register Now_.Models; namespace Register Now_. Controllers public class StudentsController Controller { { public IAction Result Index() { var students = new List { new Student { Id = 1, LastName = "Palad", FirstName = "Mateo", Email = "mp@gmail.com", Phone = "(403)-359-4714" }, new Student { Id = 2, LastName = "Pillagara", FirstName = "Zaldy", Email = "zp@gmail.com", Phone = "(403)-359-4715" }, new Student { Id = 3, LastName = "Labios", FirstName = "Lucena", Email = "11@gmail.com", Phone = "(403)-359-4716" }, new Student { Id = 4, LastName = "Gonzales", FirstName = "Gilda", Email = "gg@gmail.com", Phone = "(403)-359-4717" }, new Student { Id = 5, LastName = "Labrador", FirstName = "Adorada", Email = "al@gmail.com", Phone = "(403)-359-4718" } }; return View(students); } } //Models Course.cs namespace Register Now_.Models { { public class Course public string CourseId { get; set; } public string CourseNumber { get; set; } public string CourseName { get; set; } public string Description { get; set; } public Course() { CourseId = ""; CourseNumber = ""; CourseName = ""; Description = ""; } Instructor.cs namespace Register Now_.Models public class Instructor { { public int Id { get; set; } } public string LastName { get; set; } public string FirstName { get; set; } public string Email { get; set; } public string Teaches Course { get; set; } public Instructor() { LastName = ""; FirstName = ""; Email = ""; Teaches Course = ""; Student.cs namespace Register Now_.Models public class Student { { public int Id { get; set; } public string LastName { get; set; } public string FirstName { get; set; } public string Email { get; set; } public string Phone { get; set; } public Student() { LastName = ""; FirstName = ""; Email = ""; Phone = //Views Courses Folder index.cshtml @model List Students Enrolled × Close Courses Course ID Course Number Course Name Description Enrolled Students @foreach (var course in Model) { @course.CourseId @course. CourseNumber @course. CourseName @course.Description
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
