ASP. net mvc + LINQ develop a book sales site (4): create a prototype of ASP. net mvc application

Source: Internet
Author: User
Tags url example

After the database is created, we can develop it.

1. Create a bookshop ASP. net mvc Web Application

2. Select not to generate the test project (we need to manually create a test later ).

3. generate the following solution

4: We use the default MVC structure. The model mainly provides data and the controller mainly implements business logic. The view is mainly used to interact with users (the figure below is from scottegu)

5. We plan to access our functions in the following path (we use the Administrator's use case for example)

URL format Action URL example
/Category/List Browse all books /Category/List
/Category/edit/ID Edit a category /Category/edit/1
/Category/delete/ID Delete A category /Category/delete/2

6. next, we will create a master page for the Administrator. The master page is a shared page, that is, used by multiple pages. Therefore, we will put it in the views/shared directory and modify the default site. MASTER:

<% @ Master language = "C #" autoeventwireup = "true" codebehind = "site. master. cs" inherits = "bookshop. Views. Shared. Site" %>  <!  Doctype   Html   Public   "-// W3C // dtd xhtml 1.0 strict // en"   Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"  >  <  Html   Xmlns  = "Http://www.w3.org/1999/xhtml"  >  <  Head   Runat  = "Server" >  <  Meta   HTTP-equiv  = "Content-Type"   Content  = "Text/html; charsets = iso-8859-1"   />  <  Title  > Book Shop </  Title  >  <  Link   Href  = "Http://www.cnblogs.com/Content/Site.css"   REL = "Stylesheet"   Type  = "Text/CSS"   />  </  Head  >  <  Body  >  <  Div   ID  = "Header"  >  <  Ul  >  <  Li  > <  A  Href  = "Category/List"  > Category </  A  > </  Li  >  <  Li  > <  A   Href  = "Author/List"  > Author </  A  > </  Li  >  < Li  > <  A   Href  = "User/List"  > User </  A  > </  Li  >  <  Li  > <  A   Href  = "Comment/List"  > Comment </  A  > </ Li  >  <  Li  > <  A   Href  = "Order/List"  > Order </  A  > </  Li  >  </  Ul  >  </  Div  >  <  Div  ID  = "Content"  >  <  ASP: contentplaceholder   ID  = "Maincontentplaceholder"   Runat  = "Server"  >  </  ASP: contentplaceholder  >  </  Div  >  </  Body  >  </  Html > 
 
7. Modify site.css to the following content:

CSS
# Header
{
Width : 100% ;
Margin : 0px ;
Padding : 5px ;
Border : 0px ;
Border-bottom : Solid 1px #000 ;
}

# Header ul
{
List-style-type : None ;  
}
# Header ul Li
{
List-style-type : None ;
Float : Left ;
Margin : 5px ;
}  

. Clear
{
Clear:Both;
}

8. Now, the Administrator's master page is complete.

9. The interface is relatively simple, and we will gradually beautify it later.

 

Related Article

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.