amg262 / assign07-midterm Goto Github PK
View Code? Open in Web Editor NEWIn this assignment, you will add a new controller (Customer) to the Northwind application. You will add a controller method (Register) to the Customer controller which will return a view when requested (/Customer/Register). The view will display a form designed to add customer data to the database. You will need to add a new Model to the application (Customer). Use the attached ERD to help you design the new class. When creating your class, use data annotations to require the CompanyName field. Update the derived context adding a DBSet for Customers. Use data migrations to ensure that your database and model are in sync. Once the new table has been added to the database, design your form to add CompanyName (Do not try to insert all fields right away - more prone to mistakes). Modify the derived context - create a method AddCustomer to save a customer to the database. You will need to create a controller method in the Customer controller to respond to POST requests for Customer/Register. Use custom validation to ensure that company names are unique. Once you can save a customer in the database using CompanyName, complete the Register form to include all database fields. Update the Navbar to reflect the changes. Extra Credit: Display all customers after the new customer is successfully added.