MvcApplication5/Controllers/HomeController.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication5.Models;
using Autofac.Features.Indexed;

namespace MvcApplication5.Controllers
{
    public class HomeController : Controller
    {
        private readonly IModelCar _carmodel;
        private readonly IModelUser _usermodel;

        public HomeController(IModelCar carmodel,IModelUser usermodel)
        {
            _carmodel = carmodel;
            _usermodel = usermodel;
        }

        public ActionResult Index()
        {
            ViewBag.Message = "修改此模板以快速启动你的 ASP.NET MVC 应用程序。";
            var carname=_carmodel.GetCarName();
            var username = _usermodel.GetUserName();
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "你的应用程序说明页。";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "你的联系方式页。";

            return View();
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。