Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Select all items from local DB having a particular value

$
0
0

I implemented local DB in my project and I am using following code for select all the items from local DB. MyCommunities is my model class.

public List<MyCommunities> GetItems()
    {
        lock (locker)
        {
            return (from i in database.Table<MyCommunities>() select i).ToList();
        }
    }

I am using following code for taking an item from local DB with a particular officename(it only return one item):

public MyCommunities GetItemByOfficename(string office)
    {
        lock (locker)
        {
            return database.Table<MyCommunities>().FirstOrDefault(x => x.Officename == office);
        }
    }

I am trying to select all the items from local DB having a particular userid(It should be a list of Mycommunities). Don't know how to add userid when parsing.

Thanks in advance :)


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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