// // GET: /Traffic/Delete/5 public ActionResult Delete(int id) { if (!IsLoggedIn()) return RedirectToAction("Authenticate", "Home"); var traffic = new Traffic { ID = id }; return View(OpenErpConnection.GetConnection().GetEntity<Traffic>(e => e.ID == traffic.ID)); }
public ActionResult Delete(Traffic traffic) { try { OpenErpConnection.GetConnection().DeleteEntity(traffic); return RedirectToAction("Index"); } catch (Exception ex) { return View(); } }
public ActionResult Create(Traffic traffic) { try { var now = DateTime.Now; traffic.UpdateDate = string.Format("{0}/{1}/{2} {3}:{4}:{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); OpenErpConnection.GetConnection().AddEntity(traffic); return RedirectToAction("Index"); } catch (Exception ex) { return View(); } }