I have this in my controller:
MyTestViewModel asdf = new MyTestViewModel
{
SomeTestDate = _b.GetSomeDate(SomeID).Value,
SomeDate2 = SomeDate2.Value,
SomeDate3 = SomeDate3.Value
};
in the function "GetSomeDate" I have:
var x = c.ExecuteScalar();
return x as DateTime?;
And I get InvalidOperationException that object must contain value, when function returns null, which it should be able to.
What might be wrong here?
/M