public class Sample01Controller: Controller{[HttpGet]public ActionResult ShowAllAuthors(){using (PubsEntities pubs = new PubsEntities()){ViewData["Authors"] = pubs.Authors.ToList();}return View();}}コントローラUI
10.
<table class="..."><thead>...</thead><tbody>@foreach (Authora in (ViewData["Authors"] as List<Author>)){<tr><td>@a.AuthorId</td><td>@a.AuthorFirstName @a.AuthorLastName</td><td>@a.Phone</td><td>@a.State</td>...</tr>}</tbody></table>ビューUIサーバで描画処理
11.
Web サーバ DBサーバWeb API EFDACSIJavaScriptHTMLWeb ブラウザ※ 細かいコードは理解しなくて OK です(本日のサンプルコードは後日配布します)UI
public class Sample02Controller: Controller{[HttpGet]public List<Author> GetAllAuthors(){using (PubsEntities pubs = new PubsEntities()){return pubs.Authors.ToList();}}}Web APISIサーバはデータ返信のみ