public MsSupplier[] GetSupplier() { List <MsSupplier> mSupplier = new List <MsSupplier>(); dc = new DCAssetDataContext(); try { var query = dc.MsSupplier_View("", "G"); foreach (var res in query) { MsSupplier supplier = new MsSupplier(); supplier.SupplierCode = res.SupplierCode; supplier.SupplierName = res.SupplierName; mSupplier.Add(supplier); } } catch (Exception ex) { ViewBag.Error = ex.Message; } return(mSupplier.ToArray()); }