コード例 #1
0
        // GET: SampleVMs
        public ActionResult Index(SampleVM data)
        {
            ViewData["Name"] = "set by view data";
            //ViewData.Model = new SampleVM() {Name="set by model" };
            data.Name = "set by model";

            ViewData["ddlListSource"] = new SelectList(db.Occupation.ToList(), "OccupationId", "OccupationName", 1);
            return View(data);
        }
コード例 #2
0
 public ActionResult Index(SampleVM data)
 {
     if (ModelState.IsValid)
     {
         TempData["IndexSaveMsg"] = "新增" + data.Name + "成功";
         return RedirectToAction("IndexResult");
     }
     return View();
 }
コード例 #3
0
 public ActionResult Index(SampleVM data)
 {
     data.Name = "123";
     ViewData["Name"] = "Jhon-Mary";
     return View(data);
 }