.


:




:

































 

 

 

 





 

, ​​ - . Controllers. Add- > Controller.... ' . ϳ , HomeController Add ()

 

 

:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;

 

namespace MvcCreditApp.Controllers

{

public class HomeController: Controller

{

//

// GET: /Home/

 

public ActionResult Index()

{

return View();

}

 

}

}

, ' . , - , Controller. ³ Index, View () - . , , 䳿 . Index :

 

 

, , , , . . Credits, ' Credit.

' Credits ' ViewBag . ' ViewBag ', . ' - , .

. Index . , Add View....

 

, ' . - , Use a layout or masterpage: Add.

 

 

ϳ . Visual Studio Index.cshtml. html. :

 

@{

Layout = null;

}

 

<!DOCTYPE html>

<html>

<head>

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

<title>Index</title>

</head>

<body>

<div>

<h3> </h3>

<table>

<tr><td><p> </p></td><td><p> </p></td><td><p> </p></td><td><p> %</p></td></tr>

@foreach (var c in ViewBag.Credits)

{

<tr><td><p>@c.Head</p></td><td><p>@c.Period</p></td><td><p>@c.Sum</p></td><td><p>@c.Procent %</p></td></tr>

}

</table>

<a href="/Home/CreateBid"> </a>

</div>

</body>

</html>

 

, . @foreach (var c in ViewBag.Credits). Razor ( ). Razor , , @ C # / VB.NET.

 

' ViewBag.Credits, . .

<a href="/Home/CreateBid"> </a>

, .

 

HomeController , ' - Home. , , . mvc Index HomeController, . /Home/CreateBid , CreateBid HomeController. , .





:


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


:

:

, , 1:10
==> ...

1827 - | 1746 -


© 2015-2024 lektsii.org - -

: 0.009 .