I want something like below:
public ActionResult Index()
{
var suppliers = db.Suppliers.Include(s => s.tblStatus);
List<string> sup = new List<string>();
foreach (var x in suppliers)
{
sup.Add(x.Name.ToString());
sup.Add(x.Address.ToString());
sup.Add(x.Phone.ToString());
sup.Add(x.Mobile.ToString());
sup.Add(x.tblStatus.Status.ToString());
ViewBag.SupTotalBalance = db.SupTotalBalance(x.SupplierId).SingleOrDefault();
}
return View(sup);
}
but for now its giving me null error in x.Mobile