.


:




:

































 

 

 

 





, , . : MSSQL , . . Models CreditsDbInitializer :

' Credit . , , . Global.asax. ³ Application_Start, , :

Database.SetInitializer(new CreditsDbInitializer());

, Global.asax System.Data.Entity MvcCreditApp.Models, CreditsDbInitializer .

, , , , :

, , , . CreateBid, . HomeController :

 

 

CreateBid, a GET, - POST, [HttpGet] [HttpPost]. public ActionResult CreateBid () - .

 

public string CreateBid (Bid newBid) . ³ POST newBid . .

CreateBid. public ActionResult CreateBid () . :

 

 

. "/Home/ CreateBid " 䳿 CreateBid. GET, . ϳ POST, <form method="post" action="">. CreateBid, public string CreateBid (Bid newBid).

MVC , post ? <input type="text" name="Name" /> <input type="text" name="CreditHead" />. name Bid. . MVC, , .

, . , "³".

ϳ , .

- . . . Content, Content. Add () -> New Folder ( ).

. Site.css. Content Add () -> New Item ( ). Style Sheet ' Site.css.

 

Site.css :

body

{

font-size:.85em;

font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif;

}

header,

footer,

nav,

section {

display: block;

}

 

.menu

{

background-color:black;

height: 20px;

}

.menu ul

{

list-style:none;

}

.menu li

{

display:inline;

}

.menu a

{

text-decoration:none;

color:White;

width:150px;

padding-top: 6px;

padding-left:30px;

}

.menu a:hover

{

color:red;

}

table

{

border:1px solid silver;

vertical-align:middle;

text-align:center;

}

td

{

border:1px solid silver;

}

.menu .

. -, - html head :

<head>

<meta name="viewport" content="width=device-width" />

<link type="text/css" rel="stylesheet" href="../../Content/Site.css" />

<title>Index</title>

</head>

 

, , . , . -. - .

, - . . Views Shared. ϳ Shared . _Layout.cshtml:

_Layout.cshtml :

 

 

- Url.Content, . - , .

Html.ActionLink, - , ' . RenderBody (), - .

- . Index.cshtml :

 

 

 

CreateBid.cshtml:

, Layout = " ~ / Views / Shared / _Layout.cshtml"; -. ϳ head body. , , :

 

, MVC.





:


: 2016-12-18; !; : 263 |


:

:

, .
==> ...

1775 - | 1678 -


© 2015-2024 lektsii.org - -

: 0.015 .