小编z0r*_*rch的帖子

为什么控制器首先在ASP.NET MVC中运行?

我想改进ASP.NET MVC框架的当前实现.当前代码:

routes.MapRoute(null, "I-want-to-fly", new { controller = "Airport", action = "Fly" });

public class AirportModel 
{
   public List<Plane> Planes { get; private set; }
   public List<Pilot> Pilots { get; private set; }

   public void AddFly(Plane plane, Pilot pilot, Passenger passenger)
   {
        // . . .
   }
}

public class AirportController
{
   private AirportModel model;

   [HttpGet]
   public ViewResult Fly(string from, string to)
   {
       var planes = return (from p in model.Planes 
                            where p.CityFrom == from && p.CityTo == to
                            select …
Run Code Online (Sandbox Code Playgroud)

c# model-view-controller asp.net-mvc asp.net-mvc-3

1
推荐指数
1
解决办法
1185
查看次数