• How to create and use Web Api in ASP.NET MVC?

    by  • November 16, 2015 • Microsoft .NET Framework, Microsoft .NET Web Services, Microsoft ASP.NET MVC • 0 Comments

    ASP.NET Web API is a framework for building and consuming HTTP services that can reach a broad range of clients including browsers, phones and tablets. You can use XML or JSON or something else with your API. JSON is nice for mobile apps with slow connections, for example. You can call an API from jQuery and better utilize the client’s machine and browser.

    In this article we will show the basic database operations (CRUD) in an HTTP service using ASP.NET Web API.

    Create a new project with ASP.NET MVC and choose project type is WebApi .

    WebApi Controller:

    Add the code in Api Controller. In this Get() method show list of  all records from database and Get(int id) returns single record from database through id.

    Put() method is used to update data in database while on the other hand Post() method is used to submit new record in database.




    Namecheap.com
    Avatar of Abdul Rehman

    About

    Abdul Rehman writes on .NET technologies at GetCodeSnippet.com. GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    http://getcodesnippet.com

    Leave a Reply