Sunday, 13 December 2015

Developing Windows Azure and Web Services Lab @ 1 Ans 4

In this exercise, you will create a website that exposes the Web API for Create. Retrieve. Update. Delete (CRUD) operations on the BlueYonder database.


To implement the required functionality, you need to perform the following tasks:
1. Browse to the location where you have saved the Exercise 03.zip file.
2. Extract the Exercise 03.zip file.
3. Double-click the Exercise 03 folder.
4. Double-click the BlueYonder.Model folder.
5. Double-click the BlueYonder.Model.sin file. The BlueYonder.Model - Microsoft Visual Studio window is displayed.
6. Ensure that the Solution Explorer window is opened.
7. Right-click the Solution 'BlueYonder.Model' (1 project) node, and then select Add->New Project option from the context menu. The Add New Project dialog box is displayed.
8. Ensure that the Visual C# node is expanded under the Installed node in the left pane.
9. Select Web under the Visual C# node.
10. Select ASP.NET MVC 4 Web Application from the list of templates in the middle pane.
11. Select and replace the text in the Name text box with BlueYonder.MVC.
12. Click the OK button. The NewASP.NET MVC 4 Project dialog box is displayed.
13. Select the Web API template.
14. Click the OK button. The ValuesController.es file is displayed in the BlueYonder.Model - Microsoft Visual Studio
window.
15. Right-click the BlueYonder.MVC project in the Solution Explorer window, and then select Add Reference. The Reference Manager - BlueYonder.MVC dialog box is displayed.
16. Click the Solution node in the left pane.
17. Select the BlueYonder.Model check box in the middle pane.
18. Click the OK button.
19. Double-click the App.config file of the BlueYonder.Model project.
20. Locate the connectionStrings> section, and then select the <add> element, including its attributes.
21. Press the Ctrl+C keys to copy the element to the clipboard.
22. Double-click the Web.config file of the BlueYonder.MVC project.
23. Locate the connection Strings> section.
24. Place the cursor after the connection Strings> tag. and then press the Ctrl+V keys to paste the connection string.
Note: Ensure that you replace the name of the database server in the connection string with the name of the recently created database server on Windows Azure Management Portal.
25. Press the Ctrl+S keys to save the changes.
26. Select BUILD—Build Solution.
27. Select VIEW—Server Explorer.
28. Right-click the Data Connections node, and then select the Refresh option from the context menu.
29. Expand the Data Connections node. The BlueYonderEntities (BlueYonder.MVC) node is displayed under the Data Connections node.
30. Right-click the Controllers node of the BlueYonder.MVC project, and then select Add—Controller. The Add Controller
dialog box is displayed.
31. Select and replace the text in the Controller name text box with LocationsController.
32. Select the API controller with read/write actions, using Entity Framework option from the Template drop-down list.
33. Select Location (BlueYonder.Model) from the Model class combo box.
34. Select BlueYonderEntities (BlueYonder.Model) from the Data context class combo box.
35. Click the Add button.
36. Right-click the BlueYonder.MVC project, and then select the Set as Startup Project option from the context menu.
37. Press the Ctrl+F5 keys. The Internet Explorer window is displayed.
38. Append api/locations to the address in the address bar. and then press the Enter key. At the bottom of the Internet Explorer window, a prompt appears.
39. Click the Open button.
40. Select Notepad from the list of available programs if you are prompted to select a program to open the file. When Notepad opens, you should see a list of Location entities, encoded with the JavaScript Object Notation (JSON) format.
41. Close Notepad
42. Close the Internet Explorer window.
43. Switch to Microsoft Visual Studio 2012.
44. Close Microsoft Visual Studio 2012.

No comments:

Post a Comment