我在MVC模型文件夹中创建了一个Model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EducationMVC.Models
{
public class ScoreStudentPresentation
{
public string id { set; get; }
public string StudentNumber { set; get; }
public string Name { set; get; }
public string Family { set; get; }
public string Score { set; get; }
public string ConfirmScore { set; get; }
}
}
所以我创建了一个控制器来处理这个模型。当我想使用向导窗口创建一个这个模型的列表(即添加视图)。在下拉列表中我找不到我的模型的名称 ScoreStudentPresentation
我的Model文件夹中有几个模型,它们可以正常工作。
我的控制器代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DomainClasses;
using EducationModel;
using EducationRepositor;
namespace EducationMVC.Controllers
{
public class ScoreController : Controller
{
//
// GET: /Score/
private readonly ScoreRepository obj = new ScoreRepository();
public ActionResult Index(string scheduleId)
{
var model = obj.GetStudentlistOfSchedule(scheduleId);
return View(model);
}
public ActionResult Create()
{
return View("Create");
// return View();
}
[HttpPost]
public ActionResult Create(Lesson lesson)
{
obj.AddNewLesson(lesson);
obj.Save();
return RedirectToAction("Index", "Lesson");
}
public ActionResult Edit(int id)
{
return View(obj.FindLessonById(id));
}
[HttpPost]
public ActionResult Edit(Lesson lesson)
{
if (ModelState.IsValid)
{
obj.Update(lesson);
obj.Save();
}
return RedirectToAction("Index", "Lesson");
}
public ActionResult Delete(int id)
{
obj.RemoveLesson(obj.FindLessonById(id));
obj.Save();
return RedirectToAction("Index", "Lesson");
// return View();
}
}
}
我该怎么办?
祝你好运