Welcome to Xamarin Guy Show Blog

Keep updated for latest and Greatest Posts from Xamarin guy

Asp .net Core for Xamarin Dev Part 1

At first Fire up your your Visual Studio for windows or MAC Machine
In this tutorial we are going to create our simple API
Step 1:
Create ASP.net core WEB API in Mac where as in windows Create Asp.netcore Web Application > API
Name it as (Solution Name : TripTrackerLive Project Name: TripTracker.BackService)
Now let’s Start
Create a New Folder Name it as Model (Inside which create a class called Trip)
Trip.cs (Here we have added some annotation like key , Required we will be talking about that later )

Repository.cs

Step2:
Now our fun part begins we are going to call the controller .
Create a new Controller called as TripsController.cs Selecting Web API Controller . In Windows System with API controller with read / write actions

Before that we are going to Startup.cs inside ConfigureServices Method :
Add this line of code :

Because we want to create Model Repository objects multiple time for multiple callback over http.

Now inside TripsController.cs

Now run the app by calling api/trips For my case {https://localhost:5001/api/trips}
Output is :

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.