public List<MissedCommitID> MissedCommitIDList(CABRManagement model) { List<MissedCommitID> MissedCommitIDList = new List<MissedCommitID>(); // Here I want to check if MigrationCommitID matches CommitID then populate the list MissedCommitIDList // MigrationCommitID and CommitID fields are stored in the model.RuleDetailList //if both fields do not have the same data then populate the new list. "MissedCommitIDList " var MissedCommitID = _unitOfWorkCABusinessRules.RuleDetailRepo.Where(x => x.RuleDetailId == model.RuleDetailList.Where(m => m.RuleDetailID == x.RuleDetailId)); MissedCommitIDList = MissedCommitIDList.ToList().Select(x => new MissedCommitID { CQticket = model.RuleDetailList.Select(x => x.CQTicket); UserName = Version = Environment = commitID = }).ToList();
Please post a concise and complete example. This normally means a console program as a single file showing your concrete problem. When such a concise sample is too hard to craft - well, I never had such a case - then post only compiling, partial classes showing your problem.
At least: Format your posted code. Unnecessary empty lines or unnecessary comments are making reading too hard..
And finally: Post your error message, what CS code?
lulu50
ASKER
Hi ste5an,
Thank you for your help.
ok
I'm having problem explaining what I'm trying to do.
I have a list and a table .
What I want is to check to see if the Version, CQticket exist in the list matches with what's in the table.
once I have a matching version and CQtickets then I need to check if the commitID that is in the list exist in the table MigrationCommitID
so if the MigrationCommitID from the list do not exist in the CommitID then I need to populate the data in a new list.
this is where the data stored in my list.
public List<RuleDetailMgm> RuleDetailList { get; set; }
public class RuleDetailMgm
{
public int RuleDetailID { get; set; }
public string CQTicket { get; set; }
public string Versions { get; set; }
public string CommitID { get; set; }
public DateTime MigrationDate { get; set; }
}
the table is called "MissedMigration"
MissedMigration
MissedMigrationID int Unchecked
Version varchar(250) Unchecked
CQTicket varchar(250) Unchecked
MigrationCommitID varchar(250) Unchecked
MigrationDate datetime Unchecked
so I started working on the function
public List<MissedCommitID> MissedCommitIDList(CABRManagement model)
{
List<MissedCommitID> MissedCommitIDList = new List<MissedCommitID>();
IEnumerable<CABR_MissedMigration> list = new List<CABR_MissedMigration>();
list = _unitOfWorkCABusinessRules.MissedMigrationRepo.GetAll().ToList();
foreach (var element in model.RuleDetailList)
{
}
//I don't know how to do this here
//I want to loop thru my list and select all the version and CQticket that matches in the table called MissedMigration
//then I have to compare between the two if the commitID has any data in the MigrationCommitID
//if commitID
return MissedCommitIDList;
}
the data inside each tables are as follow:
MissedMigration Table
MissedMigrationID Version CQTicket MigrationCommitID MigrationDate
1 Version33 ENT19293 346365676 2020-02-12 00:00:00.000 //Passed because it exist in the list
3 Version22 ENT95837 553564646 2020-02-01 00:00:00.000 //Passed because it exist in the list
4 version 5 ENT83745 756555666 2020-02-07 00:00:00.000 //will not pass, not in the list
5 Version33 ENT19293 844333556 2020-02-12 00:00:00.000 //will not pass, not in the list
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
At least: Format your posted code. Unnecessary empty lines or unnecessary comments are making reading too hard..
And finally: Post your error message, what CS code?