I have the following:
protected SelectList GetReferenceOptions(string pk)
{
var options = new SelectList(_reference.Get(pk)
.AsEnumerable()
.OrderBy(o => o.Order), "RowKey", "Value");
return options;
}
protected SelectList GetReferenceOptions(string pk, string value)
{
var options = new SelectList(_reference.Get(pk)
.AsEnumerable()
.OrderBy(o => o.Order), "RowKey", "Value", value);
return options;
}
This looks like something I could combine into one but I am not sure how to handle the parameters. Can someone help me by explaining how I could do this?
If value is set to null in the first constructor you show then this would work: