Web
Analytics
WebApI in ASP.NET MVC using Razor Example - Tutorial

For Consultation : +91 9887575540

Stay Connected :

It is a framework that can serve on Http and broad range of clients like Mobile, Tablet and browsers.It is ideal platform to create REST full services on .NET framework.

Web API output can be in XML or in JSON format.

Example:

Step 1. Create Project with WEBAPI template.




Step 3: Attach View with above controller

WebApiDemo

 

Itenms

 

    @section scripts { @*@Scripts.Render(“~/bundles/jquery”);*@ }

    Step 5: Run and See Out put

    http://localhost:49371/Home/WebApiDemo/

    How to perform CRUD in EF using Web API:

    Example:

    Step 1: First create two table employee and department table in database.

    Step 2: Install Entity framework.

    Step 3: Create edmx file and take department and employee table.

    Step 4. Create Web API controller with read write scaffolding option.

    Step 5: Now run and see output of API Controller(Employee)

    Step 6: Add a action in previously created home controller and attach a view.

    EmpDemo

     

    All Employees

     

       

      Add Employee

      Name :
      Salary:
      Dateof Join
      @section scripts { }




      Download Source Code

      Select your currency