I work on asp.net core .I face issue i can't use List dirctly without convert to datatable
so How to use this code based on list without convert to datatable
var BranchesList = _OsuBranch.GetList(x => x.BRTYPE =="BR" && x.OSU_Is_Active == "Y"); DataTable dsBranchs = ConvertListToDataTable<OsuBranch>(BranchesList); if (dsBranchs.Rows.Count > 0) { foreach (DataRow br in dsBranchs.Rows) { strBranch = _OsuBranch.GetFirst(x => x.brcode == Convert.ToString(br["brcode"])).brcode.ToString(); //Convert.ToString(br["brcode"]).Trim(); AppID = _OsuBranch.GetFirst(x => x.brcode == strBranch).AppID.ToString(); } } public virtual List<TEntity> GetList(Expression<Func<TEntity, bool>> where) { return dbSet.Where(where).ToList(); } public partial class OsuBranch { [Key] public string brcode { get; set; } public string AppID { get; set; } public string jbrcode { get; set; } public string BRTYPE { get; set; } public string JSubUnit { get; set; } public string DeptNo { get; set; } public string OSU_Is_Active { get; set; } }
so How to use dirct list BranchesList and loop within it and assign strBranch and AppId