Make a business station with TAURUS.MVC (UP)

Source: Internet
Author: User

Objective:

Before is intended to write an article called: Taurus.mvc from the Introduction to Mastery, a finished article!

Later to refer to a read, or the tutorial set in this Enterprise Station project it!!!

Enterprise Station Style:

Before sent a help sister wrote the Enterprise station: Recently spent a few nights to help sister complete a corporate website

Technical style is: Text database (TXT) +webform

Transformational Style: Text database (TXT) +TAURUS.MVC

The interface to be completed today is mainly the homepage:

OK, below to start, see step by step how to do this enterprise project from scratch:

1: New ASP. NET Empty Web Application project:

2: Add a class library project called Taurus.controllers

3: Use NuGet to reference TAURUS.MVC on taurus.controllers projects:

Of course, you can also use the source code project, or find the source of the two DLLs to add a reference:

Note that the Enterprisesite project needs to refer to the Taurus.controllers project, after all, the DLL after Yi is focused on the Enterprisesite project.

4: Add the Views folder on the Enterprisesite project, and a few empty pages:

Default.html and other pages are not placed in the default folder, is not correct, the following will be corrected.

5: Copy the text database from the style and App_Data directory from the original WebForm project:

By the way, change the project name to Enterprisesite.view.

6: Copy the HTML tag of the user control of the original project and put it in the shared directory master.html:

When using the TAURUS.MVC, the wood has the concept of repeater, only HTML and JS.

There are business conditions code, you can use JS processing, but also background processing, here first with JS processing (behind the demo background processing):

The node of the template page can be placed casually, as long as the node has a name (ID or name), it can be referenced by other HTML.

The referenced property name can be id,name or individual tag such as (Head,body,title,script,style,form,meta,link)

So you can use Master.head,master,body,master.title,master.script (all only take the first node) ...

7: Copy the label from the default page from the original interface:

The original default.aspx:

Now default.html

The interface is finished, and now it's time to write the code:

8: Create a new DefaultController.cs and copy several of the Codefirst's table classes:

Get a logic folder to put, the project is simple, do not want to build too many projects, with folders:

Then, write a few methods up so that it can be loaded into the corresponding HTML file:

So the HTML is placed in the/views/default/directory.

Additional notes:

The default access path is: Localhost/default/index, locahost/default/artilelist ...

In order to get rid of the default, I added one route, the previous route pattern was only 1 and 2, and now it's a 0 more.

9: Look at the Web. config configuration:

10: Write Logic Code Binding page:

Because the project is simple, I put the business logic, directly built a class, throw controller inside, called Defaultlogic.

In order to clear the hierarchy, the students still create a new Taurus.logic class library project to put.

Logical classes need to inherit from Taurus.Core.LogicBase, so that you can pass a view object into a logical class, notice that there is a constructor.

Because the node ID of the HTML is by convention: The table name is view, bind (view) is available, and you do not need to specify a name.

Here is an event View.onforeach, used to format the time the interface renders:

Of course, the background is not the first format, then the front desk to deal with, as in the above there is a JS processing code.

11:controller invoke logic code to render the page:

Finally, a beautiful home page came out:

Finish the call:

Next several pages, including the article list, the article details, product center, as well as backstage management, the following article again.

Before the whole project was finished and then write the article, and now half of the project, the article to fill an article, ha ...

Partially completed Source: http://code.taobao.org/svn/cyqopen/trunk/Taurus.MVC.GettingStarted

Thanks everybody support!!!

Make a business station with TAURUS.MVC (UP)

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.