ahmed salah

ahmed salah

  • 1.2k
  • 547
  • 62.9k

How to return json result true when exist and false when not exist

Jun 5 2023 12:13 PM

I working on mvc asp.net csharp i need to make function return json result when branch code exist then return true and if not exist return false so can you help me do this function return json result true or false

public JsonResult CheckExist(string BranchCode)
{
 string branches = _db.Branch.Single(x => x.iBranchCode == BranchCode).iBranchCode.ToString();
// so what i write here to return true or false
}

Answers (3)