sGermosen sGermosen - 5 months ago 29
C# Question

Trying to Add an "AND" condition to LINQ using Entity

Im trying to add and condition to my LING using entity, but it said that error,


Severity Code Description Project File Line Suppression State
Error CS0019 Operator '&&' cannot be applied to operands of type
'bool' and
'int' Backend E:_PsDESARROLLO\PsInternalDEV\Backend\Areas\Medicals\Controllers\PatientsController.cs 35 Active


Does anybody know how to solve this issue?

var patient = _db.Patients.Where(p => p.Person.AuthorId == authorId && p.Person.StatusId=1);

Answer Source

Missing = here:

p.Person.StatusId=1

Change it as:

p.Person.StatusId==1