Settings: asp.net mvc web app, azure sql db, EF code-first project
I am trying to combine 3 strings and a short into one string as given below:
CompanyAddress = company.ZipCode.ToString() + " " + company.City + ", " + company.Street + " " + company.StreetNr
ZipCode is a short, all others are strings. Using this code in a controller action returns no records (and no error message when run). When I omit the ZipCode part I get all records.
I also have tried ToString(company.ZipCode) and without .ToString(). Gives a wiggle-line (does not compile) and when run no error message and no records in return, respectively. Please help.
Additional info: The code line is part of an api controller (see below), ZipCode is nullable. When ZipCode is part of the code line, then the controller delivers null, otherwise it delivers a proper string.
var companies = UnitOfWork.GetAll<Company>();
var query = company in companies
where company.Activ == true
select new ActiveCompaniesViewModel
{
CompanyAddress = company.ZipCode.ToString() + " " + company.City + ", " + company.Street + " " + company.StreetNr
};
return query;