Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

nullable boolean problem in repository query #5377


User avatar
0
BobIngham created

aspnet-core, angular: 5.4.1 I have a column in my database with a boolean data type, "IsPostedToServer". I have a nullable bool in my DTO, "IsPostedToServer". My REST endpoint receives a null, true, or false value. When converting my query to a list I use the following statement:

.WhereIf(input.IsPostedToServer != null, e => e.NcFormSubmission.IsPostedToServer == input.IsPostedToServer)

Null returns everything, as it should but true and false both return nothing. Can anyone tell me what is wrong with my code?


2 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Try: == input.IsPostedToServer.Value

  • User Avatar
    0
    BobIngham created

    @Aaron, thank you very much.