コード例 #1
0
ファイル: Service1.svc.cs プロジェクト: ameerhamza26/wcf
        public bool insertuserformobile(int id,string f, string l, string e, string p, string a)
        {
            onlinetestingEntities4 userData = new onlinetestingEntities4();
            userdata newuser = new userdata();
               newuser.user_id = id;
            newuser.firstName = f;
            newuser.lastName = l;
            newuser.email = e;
            newuser.passwor = p;
            newuser.about = a;

            //string str = string.Empty;
            //int k = 0;
            //onlinetestingEntities getUser = new onlinetestingEntities();
            //foreach (var i in getUser.userdatas.ToList())
            //{
            //    if (newuser.email == i.email)
            //    {
            //        str = "This email is already registered";
            //    }
            //    else
            //    {
            //        k++;
            //    }
            //}

            userData.userdatas.Add(newuser);
            userData.SaveChanges();
            return true;
        }
コード例 #2
0
ファイル: Service1.svc.cs プロジェクト: ameerhamza26/wcf
        public bool insertuser(users userInsert)
        {
            onlinetestingEntities4 userData = new onlinetestingEntities4();
            userdata newuser = new userdata();
            newuser.user_id = userInsert.userId;
            newuser.firstName = userInsert.first_name;
            newuser.lastName = userInsert.last_name;
            newuser.email = userInsert.Email;
            newuser.passwor = userInsert.Password;
            newuser.about = userInsert.About;

            //string str = string.Empty;
            //int k = 0;
            //onlinetestingEntities getUser = new onlinetestingEntities();
            //foreach (var i in getUser.userdatas.ToList())
            //{
            //    if (newuser.email == i.email)
            //    {
            //        str = "This email is already registered";
            //    }
            //    else
            //    {
            //        k++;
            //    }
            //}

            userData.userdatas.Add(newuser);
            userData.SaveChanges();
            return true;
        }