Creating a photo album for ASP.NET MVC 5 Users using Azure BLOB storage

In this blog post, we will integrate ASP.NET MVC with Azure BLOB Storage by saving an image for an ASP.NET Identity 2.0 user in Azure BLOB Storage. We’re going to cover a lot of ground in this post, including:

  • Using ASP.NET Identity 2.0 user as reference in other table.
  • Creating a one to many relationship with ASP.NET Identity 2.0 user table
  • Connecting an ASP.NET MVC application to Azure Storage
  • Creating or Uploading a BLOB
  • Deleting a BLOB
  • Downloading a BLOB
  • Uploading a file from MVC form to a Azure BLOB

The final output of the blog post we plan on creating in this post will look more or less like the image below. As you can see, a user can upload a photo to her album, delete a photo, and of course, view photos too.

image

Architecture of the Application

The High-level architecture of the application can be drawn as shown in the image below:

image

Creating tables to save images

When we create an ASP.NET MVC application using the given MVC template in Visual Studio, by default, a basic authentication gets created using the ASP.NET Identity 2.0. In a default MVC project, a template for the authentication and authorization purpose ASP.NET Identity 2.0 creates the tables as shown in the image below:

Read full article on the Infragistics Blog

Creating Unit Tests for ASP.NET MVC Controllers

In this blog post, we will learn to write unit tests for various MVC controller’s behaviors, such as view’s return types, redirecting to different actions etc. Specifically, we’ll cover writing Unit Tests for:

  1. ViewData of the Controller
  2. TempData of the Controller
  3. ViewBag of the Controller
  4. View of the Controller

Let’s get started!

Creating the MVC Project under Test

Let us go ahead and create a MVC project under Test. To keep things simpler, I have selected ”No Authentication” for the project. In this example we are going to write unit tests for the HomeController. The HomeController contains two action methods:

  1. Index
  2. Details

We are going to write tests for these actions. The HomeController contains code as shown here:

Read full article on the Infragistics Blog

How I did in 2015?

image

I procrastinate, hence this blog post is 12 days late. Nevertheless, I wish Happy New Year to each one of you. May you get best of the life in 2016. Many of us don’t like to read long stories and enjoy reading data in all possible ways. For data lovers here is the summary in a tabular form. However, I strongly request you to read the full story in your sweet time.

Where I was working

image

My Work

image

For me 2015 has been an ok year. Neither anything exceptional nor any fatal bad event did happen in 2015. I took 2015 on a day to day basis.

Did not enjoy as corporate Trainer

I started as a freelancer corporate trainer in January 2015 and could survived as a trainer merely for three months. It is a different kind of competition, trainer community, and vendor eco system. I did around 10 trainings in 3 months, however I realized that I don’t belong to there. I love to teach but certainly I am not a trainer. In three months, I did trainings for following clients-

  • Accenture
  • FactSet
  • Polaris Software

I will keep seeking opportunity to host workshop and teach developers, however not as so called corporate trainer. Life is too short to do the stuff you don’t enjoy, isn’t it?

Resumed as Developer Evangelist at Infragistics

I am a Developer Evangelist by instinct and aspired to enable developers all across the globe.

image

It was April afternoon when I met inspiring Jaosn Beres in one of the posh Delhi hotel. We talked about my career aspirations, strong and weak points etc. During our conversation, Jason asked me – why don’t you represent Infragistics as an evangelist in developer community? He added, you work hard and I will make the path for you to become Infragistics global evangelist. It was an offer, I could not resist. I said YES then and there.

I was Telerik evangelist till April 2014. I confess, for a year I missed being an evangelist. Teaching developers, conducing workshops, hosting webinars, and moreover enabling developers to take right decisions on the products. Jaosn offer gave breath to dying evangelist in me.

I was once again DEVELOPER EVANGELIST of Infragistics starting April 2015. Being an evangelist from April to December for the developers,

  • I wrote 36 articles on various topics like AngularJS, JavaScript, MVC, AZURE
  • I hosted 9 free webinars
  • I delivered 11 talks in various conferences and user group events.

Find recording of all the webinars here

Read all the articles here

I love to be an evangelist, and I am been doing it once again. I will focus on web based products like Ignite UI. I look forward to add more values for Infragistics Developer community in 2016.

Community rocks

image

With help of C-SHARPCORNER COMMUNITY and my personal blog, I have been teaching developers all across the country. I don’t charge to attend my workshops. A thousands of developers attend my workshop, sessions, and Infragistics day. In 2015, I focused mainly on Azure, AngularJS, JavaScript, MVC and Ignite UI.

  • I wrote 63 articles
  • I hosted 14 workshop/session
  • Hosted one session in Mathura village for school students

Looking Forward in 2016

I am very excited about 2016 and I am sure it is going be bigger and better. I look forward to add more values to Infragistics developer community as an Evangelist, to my blog readers by writing quality posts, and doing more sessions/workshop for C-sharpcorner chapter community.

I may become more ambitious also, and why to discard own Startup? 😉 Good luck everyone. Have a great 2016.

Getting started with Azure API Apps and Azure MVC web App in Azure App Service

In this article, you will learn how to create Azure API Apps and an MVC client deployed in Azure We App. This is going to be a very simple application connecting various components of Azure App services, and to build it we’re going to use Azure API App, Azure Web App, and SQL Server in Azure. A high level architecture of the application can be drawn as shown in the image below:

image

Essentially, in this post we will learn to perform the following tasks:

  • Make a SQL Connection in SQL database in Azure
  • Use the Entity Framework database-first approach to scaffold a CRUD operation
  • Expose the operations in an Azure API App
  • Configure the swagger API and UI for metadata and API testing
  • Publish the Azure API App in Azure App Service
  • Create client side code using swagger metadata API in an ASP.NET MVC Application
  • Use generated client code in MVC application to perform CRUD operations on a table in a SQL database in Azure
  • Publish the ASP.NET MVC application in Azure Web App

On completion of this post, you should have an Azure API App and an MVC-based Azure Web App running live in the Azure Service. As the output of the article, we have Azure API App running at http://schoolapiapp.azurewebsites.net/swagger/ui/index. We’ve also got an MVC-based Azure Web App running on this URL: http://mvcclientazureapiapp.azurewebsites.net/

In this example I am using Visual Studio 2015, however you can use Visual Studio 2013 too. You’ll also need a subscription to Azure, but you can get a free trial. Let’s get started!

Azure API App

Let us start with creating an Azure API App. To set up the development environment, install Azure SDK. You can download Azure SDK for Visual Studio 2015 from here and Azure SDK for Visual Studio 2013 from here. After successful installation you should get the successfully installed dialog box as shown in the image below:

image

Now your development environment is all set to create your first Azure API Apps. Let’s go ahead and create a new project, by selecting New->Project->ASP.NET Web Application. Give a suitable name to your ASP.NET Web Application, and from the template dialog box choose Azure API App as shown in the image below:

image

After successfully creating the project, do the following:

  1. Delete ValuesController from the Controller folder. We don’t need this controller.
  2. Right click on the Models folder and add a new Item.

To add a new item, select ADO.NET Entity Model from the Data tab and give a name to the model. Here, I am leaving it as SchoolModel.

image

In this step, in the Entity Data Model Wizard, select EF Designer from the database option and click on Next as shown in the image below:

image

Let us take a moment here and understand what are we going to do in next step. Here we will be connecting to a School database which is inside the SQL databases in Azure.

image

To connect to a SQL database in Azure, you need to perfom following tasks:

  • Add a client IP to the database server Firewall rule in the Azure portal
  • Provide a database server name in Azure
  • Provide a username and password using SQL Server authentication
  • Select the required database and click on OK

You may want to refer to the images below to provide information to connect to a database in Azure:

Read full article on in Infragistics Blog