public ActionResult exeRegister(Users model) { using (var db = new WebWorkSystemEntities()) { model.created_at = DateTime.Parse("2018-03-01 00:00:00"); model.created_by = "管理者"; model.updated_at = DateTime.Parse("2018-03-01 00:00:00"); model.updated_by = "管理者"; db.Users.Add(model); db.SaveChanges(); } return(View("Index")); }
public ActionResult exeEdit(Users model) { using (var db = new WebWorkSystemEntities()) { model.created_at = DateTime.Parse("2018-03-01 00:00:00"); model.created_by = "管理者"; model.updated_at = DateTime.Parse("2018-03-01 00:00:00"); model.updated_by = "管理者"; db.Entry(model).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } }