tags:

views:

351

answers:

2

Hi, I have a table which has a two fields, userid and degreeid. A user can have multiple degreeds in this table. When a user select their degree I want to delete any degree id already in the database but un-selected by user. How should do it? I try to use something like this with no luck.

repo.DeleteMany(x=>x.MeetingAttendeeUserID==userID && x.EducationDegreeID userDegreeList)

Thanks, Lewis

+1  A: 

Could you do something like this?

repo.DeleteMany(x =>
    x.MeetingAttendeeUserId == userID &&
    x.EducationDegreeID != selectedDegreeId
);

Edit: Or this.

repo.DeleteMany(x =>
    x.MeetingAttendeeUserId == userID &&
    userDegreeList.Contains(x.EducationDegreeID))
);
Skinniest Man
Thanks. I will try it.
Lewis
I know it's been ages, but did this ever work out for you?
Skinniest Man
A: 

I have tried

SubSonicRepository repo = new SubSonicRepository(db); repo.DeleteMany(x => x.ReportID == Convert.ToInt32(reportID));

and it does nothing, not even an error

addendum for someone that comes across this: don't convert in the delete call, convert your variables beforehand.

int deleteKey = Convert.ToInt32(reportID) SubSonicRepository repo = new SubSonicRepository(db); repo.DeleteMany(x => x.ReportID == deleteKey);

and it fired fine

fifolo