https://github.com/vbsantos/aspnet-todo-app
Basic Todo List App made with ASP.NET C# to learn
https://github.com/vbsantos/aspnet-todo-app
asp-net-core authentication bootstrap csharp css docker docker-compose dotnet-core html mvc sqlite
Last synced: 3 months ago
JSON representation
Basic Todo List App made with ASP.NET C# to learn
- Host: GitHub
- URL: https://github.com/vbsantos/aspnet-todo-app
- Owner: vbsantos
- Created: 2022-04-18T01:24:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-18T01:27:54.000Z (about 4 years ago)
- Last Synced: 2025-07-05T01:08:10.628Z (12 months ago)
- Topics: asp-net-core, authentication, bootstrap, csharp, css, docker, docker-compose, dotnet-core, html, mvc, sqlite
- Language: C#
- Homepage:
- Size: 918 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ASP.NET TODO APP
## Uso
- Para rodar na máquina: `dotnet run`
- Para rodar em um container: `docker-compose up --build`
## Processo
1. `$ dotnet new mvc --auth Individual`
> Gera projeto MVC com Autenticação e utilizando SQLite
2. `$ dotnet new editorconfig` && `$ dotnet new gitignore` && `git init`
3. Adicionei `Dockerfile`, `.dockerignore` e `docker-compose.yml`
4. Adicionei `Models/Todo.cs`
5. `$ dotnet clean` && `$ dotnet build`
> Para verificar se está tudo funcionando
6. `$ dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design`
> Para adicionar NuGet package
`$ dotnet tool install --global dotnet-aspnet-codegenerator`
`$ dotnet tool uninstall --global dotnet-aspnet-codegenerator`
> Passos extras do **.NET Core**
7. `$ dotnet-aspnet-codegenerator controller -name TodoController -dc ApplicationDbContext -m Todo --useDefaultLayout --useSqlite --referenceScriptLibraries`
> Esse comando só vai rodar se instalar o pacote anterior, ele cria todas as telas CRUD
```text
Added Controller : '/TodoController.cs'.
Added View : /Views/Todo/Create.cshtml
Added View : /Views/Todo/Edit.cshtml
Added View : /Views/Todo/Details.cshtml
Added View : /Views/Todo/Delete.cshtml
Added View : /Views/Todo/Index.cshtml
```
8. Adiciona Entity Framework `$ dotnet tool install --global dotnet-ef`
> Passos extras do **.NET Core**
9. `$ dotnet ef migrations add CreateTodoTable`
> Cria migration
10. `$ dotnet ef database update`
> Roda Migration
```
CREATE TABLE "Todos" (
"Id" INTEGER NOT NULL CONSTRAINT "PK_Todos" PRIMARY KEY AUTOINCREMENT,
"Title" TEXT NOT NULL,
"Done" INTEGER NOT NULL,
"CreatedAt" TEXT NOT NULL,
"LastUpdateDate" TEXT NOT NULL,
"User" TEXT NOT NULL
);
```
11. Modifiquei o código gerado automaticamente