ASP.NET-MVC-Lambda-Expression-Helpers
ASP.NET-MVC-Lambda-Expression-Helpers copied to clipboard
Same action name update issue
I tried to use expression helper to create and update, create is working fine but in edit, I have two actions with the same name Edit, I cant able to create BeginForm helper for edit. Please guide me.
public ActionResult Edit(int? id){
Employee employee = db.Employees.Find(id);
if (employee == null){
return HttpNotFound();
}
return View(employee);
}
[HttpPost]
public ActionResult Edit(Employee employee){
if (ModelState.IsValid){
db.Entry(employee).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(employee);
}
What kind of error do you receive?