コード例 #1
0
ファイル: UserController.cs プロジェクト: CatMsg/Project
        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 });

            }
        }
コード例 #2
0
ファイル: UserService.cs プロジェクト: CatMsg/Project
 internal static async Task<HttpResponseMessage> LoginService(string userName, string password)
 {
     using (var context = new Model1Container1())
     {
         var table = context.userSet;
         var info = table.Where(p => p.username == userName && p.pwd == password);
        return PageHelper.ToJson(new {msg=info});
     }
 }
コード例 #3
0
ファイル: Connection.cs プロジェクト: CatMsg/Project
        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;
            }
        }