コード例 #1
0
        public IHttpActionResult PosttblUser(tblUser tblUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            List <proc_UserDetails1_Result> user = new List <proc_UserDetails1_Result>();

            foreach (var item in db.proc_UserDetails1())
            {
                user.Add(item);
            }
            foreach (var item in user)
            {
                if (item.Email == tblUser.Email)
                {
                    return(Ok("Contains"));
                }
            }
            db.proc_UserRegisteration1(tblUser.Title, tblUser.FirstName, tblUser.LastName,
                                       tblUser.DOB, tblUser.PhoneNo, tblUser.Email, tblUser.Password, tblUser.Security);
            // db.proc_UserRegisteration(tblUser.Title, tblUser.FirstName, tblUser.LastName, tblUser.DOB, tblUser.PhoneNo, tblUser.Email, tblUser.Password);
            //db.tblUsers.Add(tblUser);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tblUser.UserID }, tblUser));
        }