Skip to content

gabrielpenteado/crud-aspnet-dotnet-csharp

Repository files navigation

CRUD-ASP.NET-.NET-C#

CRUD operations; created with ASP.NET, .NET and C#

license dot net version

Build with

C# .NET SQLite

Requirements

Instalattion

  1. to create a new project.
    dotnet new razor -o <projectName> --auth Individual

  2. Install Entity Framework package for SQLite.
    dotnet add package Microsoft.EntityFrameworkCore.SQLite

  3. Install dotnet-ef.
    dotnet tool install --global dotnet-ef

  4. Create migrations.
    dotnet ef migrations add <migrationsName>

  5. Update database.
    dotnet ef database update

  6. Scaffolding (creating controllers and views with one command).
    dotnet tool install -g dotnet-aspnet-codegenerator

  7. Generate the code based on Entity Framework.
    dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

To generate the code pages CREATE, EDIT, READ, DETAILS, DELETE for the Student model

dotnet aspnet-codegenerator razorpage Create Create -m Student -dc ApplicationDbContext -sqlite -udl -outDir Pages/Students
dotnet aspnet-codegenerator razorpage Edit Edit -m Student -dc ApplicationDbContext -sqlite -udl -outDir Pages/Students
dotnet aspnet-codegenerator razorpage Index List -m Student -dc ApplicationDbContext -sqlite -udl -outDir Pages/Students
dotnet aspnet-codegenerator razorpage Details Details -m Student -dc ApplicationDbContext -sqlite -udl -outDir Pages/Students
dotnet aspnet-codegenerator razorpage Delete Delete -m Student -dc ApplicationDbContext -sqlite -udl -outDir Pages/Students

To generate the code pages CREATE, EDIT, READ, DETAILS, DELETE for the Subscrition model

dotnet aspnet-codegenerator razorpage Create Create -m Subscription -dc ApplicationDbContext -sqlite -udl -outDir Pages/Subscriptions
dotnet aspnet-codegenerator razorpage Edit Edit -m Subscription -dc ApplicationDbContext -sqlite -udl -outDir Pages/Subscriptions
dotnet aspnet-codegenerator razorpage Index List -m Subscription -dc ApplicationDbContext -sqlite -udl -outDir Pages/Subscriptions
dotnet aspnet-codegenerator razorpage Details Details -m Subscription -dc ApplicationDbContext -sqlite -udl -outDir Pages/Subscriptions
dotnet aspnet-codegenerator razorpage Delete Delete -m Subscription -dc ApplicationDbContext -sqlite -udl -outDir Pages/Subscriptions

  • to run this project:
  1. Clone the repository.
    dotnet tool install --global dotnet-ef

  2. Run Application.
    dotnet run

🤝 Contributions

PRs Welcome
The foundation of the open source community are the contributions, them inspire us to learn and create. Any contributions are greatly appreciated.

📄 License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Gabriel Penteado

Full Stack Developer

LinkedIn GitHub Gmail