Ejemplo n.º 1
0
        public IHttpActionResult CheckIfUserExists(string userId)
        {
            bool       flag   = false;
            String     result = String.Empty;
            DataAccess objDA  = new DataAccess();

            try
            {
                String connectionString = ApplicationClass.GetDbConnectionString();
                String userExists       = String.Empty;

                const string   sqlCommand      = "XRA_CHECK_USER_EXISTS";
                SqlParameter[] paramCollection = new SqlParameter[1];

                paramCollection[0]               = new SqlParameter();
                paramCollection[0].SqlDbType     = SqlDbType.VarChar;
                paramCollection[0].ParameterName = "@USERID";
                paramCollection[0].Size          = 20;
                paramCollection[0].Value         = userId;

                result = objDA.ExecuteScalar(sqlCommand, paramCollection, connectionString);
                flag   = result == "Y";
                //var result = new
                //{
                //    x = "hello",
                //    y = "world"
                //};
            }
            catch (Exception ex)
            {
                flag = false;
                // errlog.Log("ASD", "Info", "CheckIfUserExists", userId);
            }
            return(Ok(flag));
        }