Beispiel #1
0
        public HttpResponseMessage ip()
        {
            string ss = GetClientInfo.GetIpAddress;
            try
            {
                //var ware = GetWare.Instance();
                using (var context = new Model1Container1())
                {
                    var table = context.getmyip;
                    var model = new getmyip
                    {
                        id = 1
                    };
                    var result = table.Where(p => p.id == model.id).ToList();
                    context.SaveChanges();
                    return PageHelper.ToJson(new { msg = result.First(),ip=ss });

                }
            }
            catch (Exception ex)
            {
                return PageHelper.ToJson(new { msg = ex.Source });

            }
        }
Beispiel #2
0
        public static string GetBaseIp()
        {
            try
            {
                using (var context = new Model1Container1())
                {
                    var table = context.getmyip;
                    var model = new getmyip
                    {
                        id = 1
                    };
                    var result = table.Where(p => p.id == model.id).ToList();
                    context.SaveChanges();
                    return result[0].ip;

                }
            }
            catch (Exception ex)
            {

                return ex.Source;
            }
        }