-6

I want to do the following but the only issue is that my input query is int not string and also I am searching from my RoomID which is also an integer and not a string. Let me simplify it, instead of _context.Customers.Name, I am comparing from _context.Room.Id which is an int type. This is an obligation and I have to do this. Guys ignore the .Select(Mapper.Map<>) Method, the primary focus is the int problem. I'd appreciate some help. enter image description here

Afnan Makhdoom
  • 654
  • 1
  • 8
  • 20

2 Answers2

3

One way to solve it is to convert the integers to string and do a contain.

Ex.

var needle = 234;
var haystack = 79234826;
var contains = haystack.ToString().Contains(needle.ToString());
ZarX
  • 1,096
  • 9
  • 17
2

If you want to search as if both ints are strings, just let them be strings:

    int source = 79234826;
    int toFind = 234;

    bool found = source.ToString().Contains(toFind.ToString()); 
Dmitry Bychenko
  • 180,369
  • 20
  • 160
  • 215