Your code is too hard to follow due to abbreviations used as variable names. I can't easily tell whats what.
So here is how you can filter data in the controller for use in your view. You'll need to make one or two modifications to your model.
Controller
public ActionResult Index ()
{
var model = new MyModel();
var getData = database.MyTable.Where(m=>m.AccountDescription = "Savings");
foreach(var item in getData)
{
var selectItem = new SelectListItem();
selectItem.Text = item.AccountNumber;
selectItem.Value = item.AccountNumber;
model.DropDown.Add(selectItem);
}
return View(model);
}
Model
public class MyModel
{
public MyModel()
{
this.DropDown = new List<SelectListItem>();
}
public string AccountNumber {get;set;}
public List<SelectListItem> DropDown {get;set;}
}
View
@Html.DropDownListFor(model => model.AccountNumber , model.DropDown, "<---Select--->", new { @class = "form-control", style = "width: 100%;" })
This would be how you can send data from your data store to the view as a drop down. And specifically, if i understand your question, the
.Where( clause in the controller is how you filter the data to fetch just the info you want.