ASP.NET-MVC-Lambda-Expression-Helpers icon indicating copy to clipboard operation
ASP.NET-MVC-Lambda-Expression-Helpers copied to clipboard

Same action name update issue

Open princeprasad90 opened this issue 4 years ago • 1 comments

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);
  }

princeprasad90 avatar Jan 26 '20 09:01 princeprasad90

What kind of error do you receive?

ivaylokenov avatar Feb 24 '20 08:02 ivaylokenov