by Hayeong Pyeon
- C#, .NET
- ASP.NET Core MVC
- MySQL (Community Server, Workbench)
- Entity Framwork Core
- Many-To-Many Relationships, CRUD
- Authentication and Identity: User Registration Controller, ViewModel, Validation, and Views; Login and Logout; and Authorization
- SCSS
- This application is an independent project as a review of Authentication with Identity chapter of C# course provided by Epicodus.
- The project objectives are as follows:
boxes will be checked upon completion of this project
- Many-to-many relationship is applied between
Treat
s andFlavor
s.- The application should have user authentication.
- A user should be able to log in and log out; to navigate to a splash page that lists all treats and flavors; and to click on each item to see all the treats/flavors that belong to it.
- Only logged in users should have access to create, update, and delete items (full CRUD functionality). All others can only view them (Read functionality only).
- Stylings are complete only for
Index.cshtml
andDetails.cshtml
files.
- Clone this repo.
- Open your shell (e.g., Terminal or GitBash) and navigate to this project's production directory named PierresTreats.
- Create a file named appsettings.json.
Caution
Before pushing commits with the step 4, you should have a .gitignore
file in the root directory with the following content:
obj
bin
appsettings.json
- In the
appsettings.json
file, write the following code, replacinguid
and thepwd
values with your own username and password registered for MySQL.
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;database=pierres_auth;uid=[YOUR-USERNAME];pwd=[YOUR-PASSWORD];"
}
}
- Install tools in order to use
dotnet-ef
by running the following commands:
- Has to be run globally:
dotnet tool install --global dotnet-ef --version 6.0.0
- Has to be run under the production directory:
dotnet add package Microsoft.EntityFrameworkCore.Design -v 6.0.0
- Run
dotnet ef migrations add [AddEntity]
to create a data migration for the database. Check out how to name your migration here. - Refer to the following commands when updating, deleting, and viewing migrations. These commands should be made within the production directory.
- To update the database after making a change, run
dotnet ef database update
in the terminal. - To remove the recent update, run
dotnet ef migrations remove
in the terminal. - To view the update history, run
dotnet ef migrations list
in the terminal.
- To configure Identity to work with EF Core, run the following command in the terminal.
dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore -v 6.0.0
- To compile and run the application in development mode with a watcher, run
dotnet watch run
which will open the browser automatically - if not - open the browser and navigate to https://localhost:5001.
No known bugs as of the last update made on March 20, 2024
MIT | Copyright © 2024 Hayeong Pyeon