示例#1
0
 public ActionResult Create(Order order)
 {
     order.CreateDate = DateTime.Now;
     order.LastModifyTime = DateTime.Now;
     db.Order.Add(order);
     db.SaveChanges();
     return Create();
 }
示例#2
0
 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");
 }