I\'m getting the error \"Cannot implicitly convert type \'int?\' to \'int\'. An explicit conversion exists (are you missing a cast?)\" on my OrdersPerHour at the return line
this is because the return type of your method is int and OrdersPerHour is int? (nullable) , you can solve this by returning its value like below:
return OrdersPerHour.Value
also check if its not null to avoid exception like as below:
if(OrdersPerHour != null)
{
return OrdersPerHour.Value;
}
else
{
return 0; // depends on your choice
}
but in this case you will have to return some other value in the else part or after the if part otherwise compiler will flag an error that not all paths of code return value.