Example #1
0
        public ActionResult AddUser(Ecmo_User user)
        {
            Ecmo_User model = (from a in db.Ecmo_User
                               where a.openid == user.openid
                               select a).FirstOrDefault();

            if (model != null)
            {
                return(Json(new { code = 0, msg = "已经登陆" }, JsonRequestBehavior.DenyGet));
            }
            //model = (from a in db.Ecmo_User
            //         where a.user_phone == user_phone && a.openid == null
            //         select a).FirstOrDefault();
            //if (model == null)
            //{
            //    return Json(new { code = 0, msg = "未找到" }, JsonRequestBehavior.DenyGet);
            //}
            //else
            //{
            model               = new Ecmo_User();
            model.openid        = user.openid;
            model.user_name     = user.user_name;
            model.user_hospital = user.user_hospital;
            model.user_dept     = user.user_dept;
            model.user_phone    = user.user_phone;
            model.user_date     = DateTime.Now;
            db.Ecmo_User.Add(model);
            db.SaveChanges();
            return(Json(new { code = 1, msg = "登陆成功" }, JsonRequestBehavior.DenyGet));
            //}
        }
Example #2
0
 public ActionResult yl(string openid)
 {
     if (string.IsNullOrEmpty(openid))
     {
         string returnUrl = HttpUtility.UrlDecode(Request.Url.ToString());
         string url       = WxConfig.WxReturnUrl_Base + "&returnUrl=" + returnUrl;
         return(Redirect(url));
     }
     else
     {
         Ecmo_User model = (from a in db.Ecmo_User
                            where a.openid == openid
                            select a).FirstOrDefault();
         if (model == null)
         {
             return(Redirect("index"));
         }
         return(View());
     }
 }