The design and implementation of the volleyball scoring (v)--controller in the MVC combat

Source: Internet
Author: User
Tags html form

Controller
The controller accepts the user's input and invokes the model and view to complete the user's needs. So when you click a hyperlink in a Web page and send an HTML form,

The controller itself does not output anything and do any processing. It simply receives the request and decides which model component is called to process the request.

Then use to determine which view to use to display the data returned by the model processing.

Before we design the controller, we'll look at the folder location where the controllers are located:

Controller controllers accept user requests and return to the view. The controller controls the generation of the view. Based on the requirements of this software, we design the

The controller required. We need to add the controller to the Controllers folder.

To meet the needs of this software, we currently need three controllers, namely: Guangzhongcontroller.cs,homecontroller.cs,

PlayerController.cs, three controllers return different views to the user, here, we mainly design is HomeController, other when

When we create, the system will automatically help us design the implementation (the next blog we talk about the specific problem), here, we specifically describe the HomeController;

Right-click, rename controller, select empty MVC controller,

Then click OK to complete the control creation;

The system automatically generated code can be used within the controller according to the requirements, the code is as follows:

  public class Homecontroller:controller    {        ////        GET:/home/public        actionresult Index ()        {            return View ();        }    }

Right-click on the index to add the view, the Controller view specific implementation code is as follows:

....................

The design of the HomeController is completed, and the HomeController Controller is responsible for returning the first interface of the software to the user.

The first operating interface used to render the software.

In the next blog, we will use the Microsoft EF Framework, Codefirst, to implement database connectivity, and

Specific implementations of the remaining two controllers.

 

The design and implementation of the volleyball scoring (v)--controller in the MVC combat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.