GithubHelp home page GithubHelp logo

ahmed-shaaban-elbehary / asp.netcorecrudoperationinmvc Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.01 MB

ASP.NET CORE MVC CRUD operation tutorial

C# 51.67% HTML 40.42% CSS 6.77% JavaScript 1.14%

asp.netcorecrudoperationinmvc's Introduction

Asp.netCoreCrudOperationInMvc

ASP.NET CORE MVC CRUD operation Quick Demo

#steps of starting the project

first of all we need to install Microsoft.Entityframeworkcore, Microsoft.Entityframeworkcore.sqlserver, Microsoft.Entityframeworkcore.tools

let's start the project.

1 - Create Models folder. 2 - create cs file named DbContext - DbContainer <- will Manage "transactions-processes" between you and the database using entityframeworks.

public DbContainer(DbContextOptions<DbContainer> options):base(options){ }

We have two main files "Startup.cs - appsettings"

4 - appsetting is a json file of some setting in our project in our example we define the connectionStrings

"ConnectionStrings": {
  "DefaultConnection": "Server = .\\SQLEXPRESS; Database = Employees_Db; Trusted_Connection = True; MultipleActiveResultSets = True"
},

5 - then using it in startup.cs

services.AddDbContext<DbContainer>(
    options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))
 );

6 - Create your first table in our case Employee.cs

Using migration to create our database and tables.

7 - in Package Manager Console to use it (Tools -> Nuget Package Manager -> Package Manager Console)

8 - type ( Add-Migration "InitialModel" ) will create new folder called migration contain the design of our database tables.

9 - then type ( Update-Database )

10 - go to sql server and check the new table.

then start to implement your logical code. best of luck and Enjoy! :)

asp.netcorecrudoperationinmvc's People

Contributors

ahmed-shaaban-elbehary avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.