Monday, August 24, 2009

How Edit View Work's in MVC.

public ActionResult Edit(int id,string name)
{
return View();
}
//
// POST: /Home/Edit/5
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id,string name,tblEmp ent)
{
try
{
var q = (from h in entity.tblEmp where h.ID == ent.ID select h).First();
entity.ApplyPropertyChanges(q.EntityKey.EntitySetName, ent);
entity.SaveChanges();
// TODO: Add update logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}

No comments:

Post a Comment