public IHttpActionResult Get(int id) { TransService transService = CreateTransService(); var transportation = transService.GetTransById(id); return(Ok(transportation)); }
public IHttpActionResult Get() { TransService transService = CreateTransService(); var transportations = transService.GetTransportations(); return(Ok(transportations)); }
/// <summary> /// 测试连接 /// </summary> /// <returns></returns> public static bool HelloWorld(string Server, string Port, out string msg) { try { TransService TestClass = new TransService(); TestClass.Url = @"http://" + Server + ":" + Port + @"/TransService.asmx"; string json = TestClass.HelloWorld(); MMessage <string> mmsg = Converter.Deserialize <MMessage <string> >(json); msg = mmsg.Text; return(true); } catch (Exception ex) { msg = "连接错误:" + ex.Message; return(false); } }
private void btnLogin_Click(object sender, EventArgs e) { TransService ts = new TransService(); string username = this.txtUserName.Text; string password = this.txtPassword.Text; try { string result = ts.Login(username, password); if (LotteryServiceDelegate != null) { LotteryServiceDelegate(true); } } catch { } finally { Param.Count = 1; } this.Close(); }
/// <summary> /// 构造函数 /// </summary> public CreateService() { transService = new TransService(); }
/// <summary> /// 构造函数 /// </summary> public DeleteService() { transService = new TransService(); }
/// <summary> /// 构造函数 /// </summary> public UpdateService() { transService = new TransService(); }
private TransService CreateTransService() { var transService = new TransService(); return(transService); }