save changes problem
- by ognjenb
// GET: /Transporter/Edit/5
public ActionResult Edit(int id)
{
var FilesQueryEdit = (from i in FilesEntities.transporter
where i.Id == id
select i).First();
return View(FilesQueryEdit);
}
//
// POST: /Transporter/Edit/5
[HttpPost]
public ActionResult Edit(int id, transporter trn)
{
try
{
// TODO: Add update logic here
FilesEntities.AddTotransporter(trn);
FilesEntities.SaveChanges();
return RedirectToAction("Transporters");
}
catch
{
return View();
}
}
This code inserts new row after post edited data. How to modify post action result to save changes in edited row without inserting new row