Free Code Snippets in C#, Net Framework, Office 365, ASP.Net,WPF, Visual Studio, SQL Server, Antivirus free



To check the data of the API interface, you now have direct access via the URL / Api

Instead of the address in the browser

localhost: 51081 / Projects

to enter for the http website in the browser,


Now give the URL

localhost: 51081 / API / Projects

and then receives the results in text form


Microsoft ASP automatically prepares the data itself

[{"iD_Project":1,"url":"","title":"title1","text":"text 1"},{"iD_Project":2,"url":"","title":"Title 2","text":"Text 2"}]




The attribute Produces ("application / json) before the API class automatically sets the output to Json as the output format.



    public class ProjectsController : Controller






For better testing you should use extensions in the browser.

Here it is often recommended to integrate the Chrome browser extension Postman


The tool can be found at the Chrome Shop:

"Tabbed Postman - REST Client"



No separate window required! This is the legacy postman app that can run in a Chrome tab originally developed by…

No separate window required!


This is the legacy postman app that can run in a Chrome tab originally developed by


* Now runs in tab.

* Does not present itself as a Chrome App.

* Does not open a new window.

* Accessed by clicking the Postman icon in the Chrome toolbar.


Forked from



Include with Add in the Google Chrome browser


Now if you enter the test URL like


then comes a geliederte return



Add in client

To add one enters then as Type: POST and the URL address on the Model Class

/ API / Projects

POST: http://localhost:51081/api/Projects

Additionally, you have to insert Content-Type: application / json in the header area.

In the output area of ​​Postman, the result is output with status: 201 Created.


The client sends the following text:

POST /api/Projects HTTP/1.1
Host: localhost:51081
Content-Type: application/json
Cache-Control: no-cache

{ "url": "", "title": "title 2 geändert", "text": "text 1" }



Create, Add under ASP MVC

Under ASP.Net MVC Api the Create area is correct.

MVC takes over the standard routing through the attibut [HttpPost] and the standard designation Postxxxx

        // POST: api/Projects


        public async Task<IActionResult> PostProject([FromBody] Project project)


            if (!ModelState.IsValid)


                return BadRequest(ModelState);




            await _context.SaveChangesAsync();


            return CreatedAtAction("GetProject", new { id = project.ID_Project }, project);



Result on the SQL server.

The SQL Server Object Explorer shows that the results have been added.

Attention: it was apparently the ID increased incorrectly.

Postman: Check API Controller with Chrome Extension
ASP.Net Core: Bootswatch Themes
ASP.Net Core: Install recommended additional tools


Contact for Jobs, Project Requests: