ASP.NET Core is the evolution of Microsoft ASP.NET framework as a key feature is that it runs under the .NET Core which is cross-platform, high-performance & open source development platform that mixed with ASP.NET Core allow developers to build cloud modern applications.

Properties: This folder contains the "launchSettings.json" which allow us to configure any specific configuration of our project like startup path, enviroment vars etc.

wwwroot: Contains all the public files used by our web app.

appsettings.json: This file contains all release settings.

appsettings.Development.json: This file contains all development settings.

Program.cs: Code that create the ASP.NET Core service

Startup.cs: Code that initilize our Web App service

Once we get familiarized with the project structure we can start with our ASP.NET Core Web Api by adding the nuget package that will allow us to configure Identity using MongoDB "AspNetCore.Identity.Mongo" by performing double click under Dependencies/NuGet and searching for it in the Add Packages Window.

This will add all package dependencies required for our web api now is time to setup our mongodb connection string into the appsettings.json files as I mentioned previously we have to appsettings.json files one for development and one for release in this case we will add the local connection string to the appsettings.Development.json file and the cosmosdb connection string into the appsettings.json file.

In order to configure our connection string we will need to add a new key with the name "ConnectionStrings" with a key and value for our connection string in this key we will use the following name "MongoDbDatabase", also in order to enable a security JWT config we will add 3 new keys "JwtKey" (Key Used to Encript Token), "JwtIssuer" (Token Issuer) & "JwtExpireDays" (Expire value in days), after complete the process in both files you'll see the next file structure:

Now is time to start adding some code in our project, we will add a custom User and Role entities just in case that you want to add a custom field into your app roles and users, the files structure will be the next:

After add both files into our project now we can configure our Identity MongoDB service into the Startup.cs -> ConfigureServices methodby adding services.AddMongoIdentityProvider<TUser, TRole>(stringConnection, optionsConfigCallback); in the optionsConfigCallback we can set common identity settings for User, Password, SignIn and many others configuration items.

Also in this method we will need to add the JWT Security Authentication config the Startup.cs -> ConfigureServices will be something similar as the following code:

Now we're able to start creating a few entities to transfer json client request/responses into C# objects and manipulate then usen the annotations standard helpers and avoid extra manual validation we need 3 for responses and 2 for requests using the next structure:

After that we will be able to create our main controller to expose 3 main endpoints 1 for register, 1 for login and 1 for retrieve user data we can re-use the default values controller under Controllers folder or just create a new one under the Controllers folder(right-click -> Add -> New File)

Your controller need to have the base class and router configuration

"api/v1/" - will be the default path for out endpoint as a good practice you can use versioning for your endpoints is not mandatory but I'll help to manage different versions of your endpoints.

"[controller]/" - this will take the name of your controller if you use standard naming for controller like this examples "User-Controller" controllertype + "Controller" in this case the api will take the controllertype name "user" "api/v1/user".

"[action]" - this will take by default the name of the method as the name of the action in this case "userdata", "register" & "login".

you'll noticed that 2 endpoints doesn't need to be protected since we will recibe only info to register/login but for the "userdata" we will add an standard authentication validation using a Bearer token that one will be provide over the json reponse of regiser and login endpoints the final code for UserController will be the next

After this now we're able to test our endpoints in any client library like postman since we have a self signed ssl certificate for localhost make sure that your client allow to consume that kind of services.

The config will be the next for requests.
1) Request Headers:
/api/v1/user/register & /api/v1/user/login
Content-Type: application/json

If you want to publish your service to azure is very easy using the visual studio tool and follow the steps there:

We just completed our api service code now we need to create a client to consume our service in the final part I'll show you how to create a very fast Mobile App using Xamarin.Forms to consume our rest services.

Xamarin.Forms: Custom Context Actions on iOS
Hello folks now is time to talk about customize context action views on Xamarin.Forms cell for iOS (yes the red/light-gray options that appear when you swipe a cell) the default colors are not a good-looking, so right now is a little bit tricky to achieve that but we will use a reflection technique to achieve the next two escenarios: Change background color for default and destructive context actionSet custom view for default and destructive context action
first at all, lets take a look to native impl. on Xamarin.Forms Github project on the next url https://github.com/xamarin/Xamarin.Forms/blob/ae92582d5acad2b8aeab9a2ed5b490561e71bd6c/Xamarin.Forms.Platform.iOS/ContextActionCell.cs#L14

Here we have two key items "DestructiveBackground" and "NormalBackground" both are the Images that Xamarin.Forms use to put as background on the default ContextActions view(Gray/Red)