- C#
- .NET
- ASP.NET MVC
- MySQL
- EF Core
- EF Migrations
This application presents users with a splash page for a guitar vendor. Users are presented with a list of stores and a list of guitars. Users can navigate to Manage guitars or Manage stores to begin adding to their respective lists. Note: a store will have to be added before a guitar can be added. To add a store, users can navigate to a form where they enter a name and description for the store. They can then view the stores details by selecting it. Users can also edit the stores information, and delete it from the application if they wish.
To add a guitar, users can navigate to a form where they enter a guitar's brand, model, color, type, price, year, and then select a store to add it to. They can view a guitars details by selecting it. Users can also edit a guitar, and delete it from the application if they wish.
There is a many-to-many relationship between guitars and stores here. As in, a guitar can belong to many stores, and a store can sell many guitars. Users can add multiple stores to a guitar, and multiple guitars to a store. Users can also delete an individual guitar from a store, or an individual store from a guitar.
Install the tools that are introduced in this series of lessons on LearnHowToProgram.com.
- Clone this repository to your desktop.
- Open the terminal and navigate to this project's production directory called
GuitarVendor. - Within the production directory
GuitarVendor, create a new file calledappsettings.json. - Within
appsettings.json, put in the following code, replacing theuidandpwdvalues with your own username and password for MySQL. For the LearnHowToProgram.com lessons, always assume theuidisrootand thepwdisepicodus.
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;database=guitar_vendor_with_many_to_many;uid=root;pwd=epicodus;"
}
}-
Create the database using the migrations in the Guitar Vendor project. Open your terminal to the production directory called
GuitarVendor, and rundotnet ef database update.- If you need to create your own migration, run the command
dotnet ef migrations add MigrationName, whereMigrationNameis your custom name for the migration in UpperCamelCase format.
- If you need to create your own migration, run the command
-
Within the production directory called
GuitarVendor, rundotnet watch runin the command line to start the project in development mode with a watcher. -
Open the browser to https://localhost:5001. If you cannot access localhost:5001 it is likely because you have not configured a .NET developer security certificate for HTTPS. To learn about this, review this LearnHowToProgram lesson: Redirecting to HTTPS and Issuing a Security Certificate.
When validating properties for models that are integers, the default message that displays is not necessarily clear or easy to understand. While it does technically work, I would like to address this issue.
MIT
Copyright(c) 2023 Brian Scherner
- Add identity and authorization with user roles to project.
- Implement two roles, customer and vendor.
- Customer should only have read functionality, and the ability to purchase a guitar (which will be added at a later point)
- Vendor should have full CRUD functionality