public ActionResult EditDirection(Direction reg) { try { dir.UpdateDirectionDetached(reg); dir.SaveDirection(); return(RedirectToAction("GetDirection")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }