You may not come up with this question if you read the error message carefully, since its clear enough. Anyway, you have to use ==
here for comparing two values, =
is for assignment purpose(basic knowledge). After making this small change your query will look like the following:
var item = model.Where(d => d.DATE2.Date.Month == dto.StartDate.Month).FirstOrDefault();
You can make them even simple by using FirstOrDefault
instead for Where
as like this:
var item = model.FirstOrDefault(d => d.DATE2.Date.Month == dto.StartDate.Month);