manish jadhav
manish jadhav

Reputation: 15

How to Use Where clause in get API

I am creating API to Get Data from Table. My table is Tbl_Menu.

      Id      MenuName     Status
-----------------------------------------------------
        1    idli            True
        2    Utappa          false
        3    MeduWada       True

i want data in API GET having only Status = true.

My Get API is

public IEnumerable<Tbl_Menu> GetTbl_Menu()
        {
            var tbl_menu = db.Tbl_Menu;
            return tbl_menu.AsEnumerable();
        }

I have to use Where Clause. so what changes I suppose to do.

Upvotes: 1

Views: 2043

Answers (1)

levent
levent

Reputation: 3634

check this.

var tbl_menu = db.Tbl_Menu;
return tbl_menu.Where(t=> t.Status == true).ToList();

Upvotes: 2

Related Questions