2016-12-03 60 views
1
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); 
     } 

回答

1

我覺得你的問題是顯而易見的。你錯誤地通過EmployeController employe在你的行動創建(後)。改變你的實際模型。