public IHttpActionResult CheckUserNameExist([FromBody]ApiPost_Login_CheckUserNameExist name)
        {
            HuoDongYou.Models.Entities.AmigoWallEntities db = new Models.Entities.AmigoWallEntities();

            bool IsExistNickName = db.AspNetUsers.Any(u => u.NickName == name.NickName);
            bool IsExistEmailName = db.AspNetUsers.Any(u => u.Email == name.Email);
            string error = "";
            if (IsExistNickName)
            {
                if (IsExistEmailName)
                {
                    error = "昵称和邮箱重复";
                }
                else
                {
                    error = "昵称重复";
                }
            }
            else if (IsExistEmailName)
            {
                error = "邮箱重复";
            }
            else
            {
                return Json(new
               {
                   Code = 10000,
                   Detail = new
                   {
                       IsValid = true
                   }
               });
            }

            return Json(new
                {
                    Code = 10000,
                    Detail = new
                    {
                        IsValid = false,
                        error = error
                    }
                });


        }
        public async Task<IHttpActionResult> OrgLogin([FromBody]ApiPost_Login_OrgLogin para)
        {
            HuoDongYou.Models.Entities.AmigoWallEntities db = new Models.Entities.AmigoWallEntities();


            string grant_type = "password";
            //  string password = string.Empty;
            //password = HttpContext.Current.Application["access_token_token"].ToString();
            // string username = db.AspNetUsers.First(u=>u.PhoneNo==mobile&&!u.IsOrganization).UserName;
            string password = BlobString.PasswordString;

            ASCIIEncoding encoding = new ASCIIEncoding();
            string postData = "grant_type=" + grant_type;
            postData += ("&password="******"&username="******"http://newhuodongyou.chinacloudsites.cn/token");

            HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://192.168.1.26:47897/token");

            myRequest.Method = "POST";
            myRequest.ContentType = "application/x-www-form-urlencoded";
            myRequest.ContentLength = data.Length;
            Stream newStream = myRequest.GetRequestStream();

            // Send the data.
            newStream.Write(data, 0, data.Length);
            newStream.Close();

            // Get response
            HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
            StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
            string content = reader.ReadToEnd();
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(content);
            //  bool isComplete = db.AspNetUsers_Person.Include("AspNetUsers").First(u => u.PhoneNo == mobile).AspNetUsers.Sex < 2;

            return Json(new
            {
                Code = 10000,
                Detail = new
                {
                    token = json["access_token"].ToString(),
                    IsValid = true,
                    expired = json[".expires"].ToString()
                }

            });
        }
        public IHttpActionResult HdyWeb(string id)
        {
            id = HttpContext.Current.Server.UrlDecode(id);
            string[] z = id.Split('$');
            string recordId = z[1];
            HuoDongYou.Models.Entities.AmigoWallEntities db = new Models.Entities.AmigoWallEntities();
            var confirm = db.cm_ConfirmLogin.Single(u => u.id == recordId);
            if (!confirm.IsValide && confirm.AddDate > UtilityHelper.getNow().AddMinutes(-2))
            {
                confirm.IsValide = true;
                confirm.ScanDate = UtilityHelper.getNow();
                confirm.UserName = User.Identity.Name;
                db.SaveChanges();
                return Json(new
                {
                    r = true,
                    data = id
                });
            }
            return Json(new
            {
                r = false
            });

        }