public ActionResult Add(tb_node_model model) { return(this.Visit(EnumUserRole.Admin, () => { tb_node_dal Dal = new tb_node_dal(); model.nodecreatetime = DateTime.Now; model.nodelastupdatetime = DateTime.Now; using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); Dal.AddOrUpdate(PubConn, model); } return RedirectToAction("index"); })); }
protected override void Run() { SqlHelper.ExcuteSql(GlobalConfig.TaskDataBaseConnectString, (c) => { var sqldatetime = c.GetServerDate(); tb_node_dal nodedal = new tb_node_dal(); nodedal.AddOrUpdate(c, new Domain.Model.tb_node_model() { nodecreatetime = sqldatetime, nodeip = System.Net.Dns.GetHostName(), nodelastupdatetime = sqldatetime, nodename = "新增节点", id = GlobalConfig.NodeID }); }); }