public ActionResult Create(Order order) { order.CreateDate = DateTime.Now; order.LastModifyTime = DateTime.Now; db.Order.Add(order); db.SaveChanges(); return Create(); }
public ActionResult Edit(Order order) { try { order.LastModifyTime = DateTime.Now; db.Entry(order).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } catch (Exception ex) { return Content(string.Format("<script >alert('编辑失败,错误信息:{0}');window.history.go( -1 );</script >", ex.Message), "text/html"); } return Content("<script >alert('编辑成功!');window.history.go( -1 );</script >", "text/html"); }