ahmed salah

ahmed salah

  • 1.1k
  • 547
  • 49.1k

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)