title: Asp.Net Web api: view all logged in users
body: <p>I tried to implement the function without success</p>
  <p>I want to check if the user's <strong>status</strong> is true so that means he is logged in</p>
  <p>I mean if <strong>Status</strong> is false then I do not want to display it at all in a list that will be ignored</p>
  <p>What I tried causes all the connected to be displayed even if they are <strong>false</strong></p>
  <p>Model:</p>
  <pre><code>[Table(&quot;Contact&quot;)]
  public partial class Contact
  {
      [Key]
      public Guid Id { get; set; }
      public string DisplayName { get; set; } = null!;
      public string ProfilePic { get; set; } = null!;
      public int? Rating { get; set; }
      public bool? Status { get; set; }
      public bool? IsRegistration { get; set; }
  }
  </code></pre>
  <p>DbContext:</p>
  <pre><code>public virtual DbSet&lt;Contact&gt; Contacts { get; set; } = null!;
  </code></pre>
  <p>Repository:</p>
  <pre><code>private readonly TalkBackContactsDbContext _context;
  
  public ContactsRepository(TalkBackContactsDbContext context)
  {
      _context = context;
  }
  
  public IQueryable&lt;Contact&gt; GetAllConnectedUser(Contact contact)
  {
  
      if (contact.Status == false)
      {
          throw new Exception(&quot;Not exist&quot;);
      }
      else
      {
          return _context.Contacts;
      }
  }
  </code></pre>
  <p>api controller:</p>
  <pre><code>private readonly IContactsRepository _repo;
  public ContactsController(IContactsRepository repo)
  {
      _repo = repo;
  }
  
  [HttpGet()]
  public IEnumerable&lt;Contact&gt; GetAllConnected()
  {
      var contact = new Contact();
  
      try
      {
          return _repo.GetAllConnectedUser(contact);
      }
      catch (Exception e)
      {
          e.ToString();
      }
      return _repo.GetAllConnectedUser(contact);
  
  }
  </code></pre>