using System; using System.Linq; using System.Web.Mvc; using System.Data; using Microsoft.Practices.EnterpriseLibrary.Data; namespace DSWeb.MvcShipping.Controllers { public class IPLimitController : Controller { // // GET: public ActionResult Index ( ) { return View(); } // public string UpdateIPAddress (string name) { //ip更新状态 string message = "0"; try { string delsql = "delete from sys_iplimit where oper = '" + name + "'"; Database db = DatabaseFactory.CreateDatabase(); db.ExecuteNonQuery(CommandType.Text, delsql); string clientIP = System.Web.HttpContext.Current.Request.UserHostAddress; string inssql = "insert into sys_iplimit (ip,oper) values('" + clientIP + "','" + name + "')"; int rst = db.ExecuteNonQuery(CommandType.Text, inssql); message=rst>0?"1":"0"; } catch (Exception) { message = "0"; } return message; } } }