namespace Employee.Controllers
{
public class EmployeController : Controller
{
EmployeeEntities db = new EmployeeEntities();
// GET: Employe
public ActionResult Index()
{
return View(db.Tables.ToList());
}
// GET: Add Employee
[HttpGet]
public ActionResult Create()
{
return View();
}
[HttpPost]
// POST
public ActionResult Create(EmployeController employe)
{
if(ModelState.IsValid)
{
db.Tables.Add(employe);
}
return View(employe);
}
答案 0 :(得分:1)
我认为你的问题很明显。你错误地在你的动作Create(post)中传递了s.
。用你的实际模型改变它。