Forum Discussion

Mirza007's avatar
Mirza007
Copper Contributor
Mar 19, 2023

ASP.NET CORE ON UBUNTU.

Hi, can anybody guide me to make a CRUD operation of asp.net core MVC with vscode? 

3 Replies

  • LanHuang's avatar
    LanHuang
    Former Employee

    Hi Mirza007,

    Thanks for posting your issue here.

    However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
    Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
    Best Regards,
    Lan Huang

  • George_Mebz's avatar
    George_Mebz
    Copper Contributor

    Mirza007 

    1. Install the necessary tools and packages: You will need to install .NET Core SDK, Visual Studio Code, and the C# extension for Visual Studio Code.

    2. Create a new ASP.NET Core MVC project: Open Visual Studio Code, and in the terminal window, navigate to the folder where you want to create the project. Type the command "dotnet new mvc" to create a new ASP.NET Core MVC project.

    3. Create a Model class: In the "Models" folder, create a new class to define the data model for your CRUD operation.

    4. Create a DbContext class: In the "Data" folder, create a new class that inherits from DbContext to define the database context for your application.

    5. Create a Controller class: In the "Controllers" folder, create a new class to handle the CRUD operations for your data model. Use the "Scaffold Item" command to generate the controller and views for your data model.

    6. Update the Views: In the "Views" folder, update the generated views to match your requirements.

    7. Test the CRUD operation: Run the application using the "dotnet run" command and test the CRUD operation using a web browser.

    These are the basic steps for creating a CRUD operation in ASP.NET Core MVC with Visual Studio Code. For more detailed instructions, you can refer to the official Microsoft documentation.

  • Yin_Zhang's avatar
    Yin_Zhang
    Copper Contributor
    Hi Mirza007, please refer to "Get started with ASP.NET Core MVC" on MS Learn at https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-6.0&tabs=visual-studio-code&WT.mc_id=DT-MVP-5005194

Resources