Click here to Skip to main content
16,018,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
[HttpPost]
public ActionResult Create([Bind(Include = "EmpId,Name,Department,Mobile,Address")] employee Employee)
{
  if (ModelState.IsValid)
  {
    dc.Employees.Add(Employee);
    dc.SaveChanges();

    return RedirectToAction("Index");
  }

  return View(Employee);
}
Posted
Updated 24-Dec-14 10:05am
v2
Comments
Kornfeld Eliyahu Peter 24-Dec-14 16:21pm    
Your question is unclear - please try to improve it...

1 solution

Your question is unclear. Can you copy/paste the exact error message you get when calling this method?

My guess would be that your database structure differs from your Employee model.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900