Skip to content

remy-says-hi/section-5-to-do-list-with-auth-csharp-net6

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

What Is This?

This is an example repo corresponding to multiple lessons within the LearnHowToProgram.com walkthrough on creating a To Do List application in Section 5: Authentication with Identity.

This project corresponds to the classwork and lessons that describe how to use Identity in an ASP.NET Core MVC project to authenticate users. This project contains a one-to-many relationship between Item and Category, and a many-to-many relationship between Item and Tag, and a one-to-many relationship between ApplicationUser and Item. There are multiple lessons in this series. The first lesson in the series is Identity Setup and Configuration.

There are multiple branches in this repo that are described more below.

How To Run This Project

Install Tools

Install the tools that are introduced in this series of lessons on LearnHowToProgram.com.

If you have not already, install the dotnet-ef tool by running the following command in your terminal:

dotnet tool install --global dotnet-ef --version 6.0.0

Set Up and Run Project

  1. Clone this repo.
  2. Open the terminal and navigate to this project's production directory called "ToDoList".
  3. Within the production directory "ToDoList", create a new file called appsettings.json.
  4. Within appsettings.json, put in the following code, replacing the uid and pwd values with your own username and password for MySQL. For the LearnHowToProgram.com lessons, we always assume the uid is root and the pwd is epicodus.
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Port=3306;database=to_do_list_with_auth;uid=root;pwd=epicodus;"
  }
}
  1. Create the database using the migrations in the To Do List project. Open your shell (e.g., Terminal or GitBash) to the production directory "ToDoList", and run dotnet ef database update.
    • To optionally create a migration, run the command dotnet ef migrations add MigrationName where MigrationName is your custom name for the migration in UpperCamelCase. To learn more about migrations, visit the LHTP lesson Code First Development and Migrations.
  2. Within the production directory "ToDoList", run dotnet watch run in the command line to start the project in development mode with a watcher.
  3. 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 lesson: Redirecting to HTTPS and Issuing a Security Certificate.

Available Branches

1_identity_setup: This branch includes the code we added after working through the following lesson:

2_authentication: This branch includes the code we added after working through the following lessons:

3_authorization: This branch includes the code we added after working through the following lesson:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 81.9%
  • HTML 17.9%
  • CSS 0.2%