2016-12-03 78 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在你的行动创建(后)。改变你的实际模型。