MVC成长记_MVC基础

来源:互联网 发布:画立体几何的软件 编辑:程序博客网 时间:2024/06/09 19:56

@model String

  • lowcase define the type of data coming into the view.
  • model give us access to data passed into our view from a controller.
  • uppercase accesses the model data passed into the view.
  • controller send data to view.

controller

  • namespace
  • class
  • method return IactionResult are called action method provided responses usable by browser.

Routing

  • How do Routes Map Up with Controllers?
    • By default,the first section of the route maps up to the controller of the same name,and the second section maps up to an action within that cotroller of the same name.
    • When we dont have the route part of url, asp.net mvc will use a default route.

Model

  • Create a class including members and some functions.

Getting user Input

  • steps to the solution that user use input.
    • Create from in a view.
    • Add Create() method to controller.
    • Move existing logic out of the Index() into Create()

Retaining Data

  • We should use either an array or list to handle our group of characters.
  • Adding new object to an array.
  • Adding a new object to a list.
  • List let us more than one obj
原创粉丝点击