Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to retrieve data based on the ID of the user who log's in.

$
0
0

I can already pass the ID of the User who log's in, Here is my code:

var data1 = data.Where(x => x.uname == pUser.Text && x.pword == pPass.Text).FirstOrDefault();
if (data1 != null)
{
Toast.MakeText(this, "Login Success", ToastLength.Short).Show();
Intent user = new Intent(this, typeof(userProfile));
user.PutExtra("Id", data1.id.ToString());

                StartActivity(user);
        }
        else
        {
            Toast.MakeText(this, "Username or Password invalid", ToastLength.Short).Show();
        }
    }
        catch (Exception ex)
        {
            Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
        }

Here is my activity where i receive the ID:

    Intent i = this.Intent;
        String name = i.Extras.GetString("Id");
        String img = i.Extras.GetString("img");

        viewID.Text = name;

How to get the data of the User who log's in using the ID i passed?

Thanks in advance :)


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>