Assignment II (WPF Application and Entity Framework Core) This assignment is based on the work done recently in the class (WPF and Entity Framework). You will be refactoring the database code we wrote...

I need this assignment to run inVisual Studio Community 2019 and file to be created in WPFApp(.Net Core).It should create a database and connect to the UI domain classes, as pdf file.


Assignment II (WPF Application and Entity Framework Core) This assignment is based on the work done recently in the class (WPF and Entity Framework). You will be refactoring the database code we wrote in the class and use it with a given xaml code to build a small WPF application that interfaces a Sql Server database. Step1: Initialization • Create a new project (WPF App(.Net Core)) • Import the classes we created in week 9 (Book, Author, CollegeDbContext, and Course from W9_CodeFirstDemo (available in Slate)) • Change the database name (in CollegeDbContext) to a2db • Using NuGet package manager console, install the packages needed to work with a database, namely o Microsoft.EntityFramworkCore o Microsoft.EntityFramworkCore.Design o Microsoft.EntityFramworkCore.Tools o Microsoft.EntityFrameworkCore.SqlServer • Create the new database by running the command update-database in the NuGet package manager console. Step 2: Refactoring We want to encapsulate any code that deals with the database in one class. This way, the UI classes do not need to know anything about the database implementation (DbContext). To do so, you should add a new class (Repository) that provides the methods below (note that you can use the code we already wrote in Program.cs (W9_CodeFirstDemo)) Notes: • AddBook o The method should throw an exception if there is a book with the same title. o The method should call the method GetAuthor to check if there is an author with the same name in the database  If there is no author with the same name, the method should create a new author • AddCourse o The method should throw an exception if there is a course with the same title. • GetCourseByTitle and GetAuthor o These methods should return null if nothing is found in the database • GetAllBooks o This method should return a list of all the information of every book in the database (including the author information) • AssignBookToCourse o The method should throw exceptions if the book or the course does not exist in the database. Step3: Connect UI to the domain classes The code snippet, attached to the assignment folder (UI-Code.txt), contains the XAML code that should be copied to the file MainWindow.xaml (you should place it inside the tag. Line 10). It will generate an interface like following: The UI include controls that support providing the following features from the Repository class: - Add a new book - Add a new course - Assign a book to course - Show course information (by searching by title). Your task is to link the code you wrote previously to the provided interface. Notes: - You are allowed to change the UI code if you want to match the size (width and height) to your screen or to do any other change. - In the code behind file (MainWindow.xaml.cs), you need to create an instance of the Repository class to support implementing the required features. - You must give names to all the text boxes you want to use in your code using the attribute x:name="VariableName". This way you can use them in your code to get the user input by using VariableName.Text - You should use the buttons to create events that use the code you wrote in the Repository class and the UI controls needed for every feature. - To show any message to the user, you can use MessageBox.Show("something"); Submission - A zip file contains all the files of the project.






Mar 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here