/COMP40010CloudSurvey

Test code for comp40010 module cloud survey

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Cloud Survey Sample

The Cloud Survey sample demonstrates how to build modern web applications using the latest tools such as ASP.NET MVC 4, Ember.js, and SignalR. This sample consists of a survey designer page, a survey page, and a survey summary page. Each of the pages uses Ember.js to update the UI in real time and perform data binding. The survey summary page also uses SignalR to update the survey results in real-time as surveys are completed.

This sample is designed to be deployed to Windows Azure Web Sites and uses a Windows Azure SQL Database for persistence. You can run this site in either shared or reserved mode on Windows Azure Web Sites with any number of instances.

Below you will find system requirements and deployment instructions.

System Requirements

Additional Resources

Click the links below for more information on the technologies used in this sample.

Deployment Instructions

  1. To begin, either download the latest version of the sample by clicking the Zip button on this page or by performing a git clone of this repository. You can either use the git command line tool or Github for Windows to clone the repository.

  2. Next, you will need to create a Windows Azure Web Site and SQL Database. Navigate to the Windows Azure Management Portal, sign-in using your Microsoft Account, and then click the New button in the lower left corner of the page.

  3. Click "Web Site" and then "Create with Database".

New Web Site

  1. Complete the create web site form by setting you site URL, region, and subscription. Click the arrow to continue.

Create Web Site

  1. Next, specify the database information. You can use an existing SQL Database server or create a new one. After you complete the form, click the arrow to continue.

Specify database settings

  1. If you selected to create a new database server you will be asked to provide the credentials and region. If you used an existing server you will be asked to provide your existing SQL credentials. After you have completed the form, click the button to create your Web Site and database.

Create a server

  1. It will take a few seconds for your site and database to be created. After they are ready click the site to enter the dashboard. In the dashboard click the link to "Download publish profile." If you haven't already done this before you will need to setup your deployment credentials first. You can do this by clicking the deployment credentials link.

The publish profile contains all information needed to publish an application to your new Windows Azure Web Site. It includes deployment credentials and database credentials. Make sure to delete this file when you are finished or store it in a secure location.

Download publish profile

  1. Now open the Cloud Survey application in Visual Studio. You can find the solution file at /src/CloudSurvey.sln. After the solution opens, right-click the CloudSurvey project and click "Publish".

Publish Web Site

  1. Next the Publish web application dialog will open. Click the import button. Select the publish profile you downloaded previously. Click publish to continue.

Publish web application

  1. After you have imported your publish profile the settings neccisary to publish the will be configured automatically. You will see the various Web Deploy settings such as Service URL and Username have been populated. Click publish to continue.

Publish web application

  1. Next you are asked to set the connection strings to the databases. This information has also been configured from the publish profile and is set to the database you created for this web site. Click publish to publish the application.

Publish web application

  1. Publishing the site will take a few seconds. After it is complete Visual Studio will open the site in the browser. You will first be presented with the login page.

The default credentials are 'admin' and 'Contoso123!'. You can change the default credentials by modifying the following code in the Global.asax.cs file.

// Create an admin account
if (Membership.FindUsersByName("admin").Cast<MembershipUser>().FirstOrDefault() == null)
{
    Membership.CreateUser("admin", "Contoso123!", "admin@contoso.com");
}

Cloud Survey Login

  1. After you login you can create your first survey. To create a survey click the "New Survey" button.

Fields in the survey editor can be modified by double clicking the text. You can see below how you can edit the survey title.

Create new survey

  1. Add questions by clicking the "Add question" button. You can select three different question types: text, boolean, or scale.

Create question

  1. Click the survey link to go to go to the survey form. You can see each of your questions are availible immediately without having to explicitly save your survey.

Survey Form

  1. Admins can view the survey results on the summary page. In the survey editor click "view summary" to view the results.

Notice that if you complete the survey form again, the survey summary page will update automatically. The application uses SignalR to push updates to the UI in real-time.

Summary