Bài đăng

Part 4: Adding an Admin View theo http://www.asp.net/

Hình ảnh
Add an Admin View Now we’ll turn to the client side, and add a page that can consume data from the Admin controller. The page will allow users to create, edit, or delete products, by sending AJAX requests to the controller. In Solution Explorer, expand the Controllers folder and open the file named HomeController.cs. This file contains an MVC controller. Add a method named  Admin : public ActionResult Admin () { string apiUri = Url . HttpRouteUrl ( "DefaultApi" , new { controller = "admin" , }); ViewBag . ApiUrl = new Uri ( Request . Url , apiUri ). AbsoluteUri . ToString (); return View (); } The  HttpRouteUrl  method creates the URI to the web API, and we store this in the view bag for later. Next, position the text cursor within the  Admin  action method, then right-click and select  Add View . This will bring up the  Add View  dialog. In the  Add View  dialog, name the view "Admin". Select the check box lab

http://www.asp.net/mvc/overview/views

http://www.asp.net/mvc/overview/views

A .NET Developer Primer for Single-Page Applications theo http://msdn.microsoft.com/

Hình ảnh
A .NET Developer Primer for Single-Page Applications Long Le Download the Code Sample A majority of Microsoft .NET Framework developers have spent most of their professional lives on the server side, coding with C# or Visual Basic .NET when building Web applications. Of course, JavaScript has been used for simple things such as modal windows, validation, AJAX calls and so on. However, JavaScript (client-side code for the most part) has been leveraged as a utility language, and applications were largely driven from the server side. Lately there’s been a huge trend of Web application code migrating from the server side to the client side (browser) to meet users’ expectations for fluid and responsive UX. With this being the case, a lot of .NET developers (especially in the enterprise) are dealing with an extreme amount of anxiety about JavaScript best practices, architecture, unit testing, maintainability and the recent explosion of different kinds of JavaScript libraries. Part