I need this code to not add the draft document to the list if the loged in user is not the documents author.
Should it work?
- var listofdocuments = dbContext.Documents.ToList();
- var filtered = new List
() ; - foreach (var document in listofdocuments)
- {
- if (document.IsDraft)
- {
- if(document.Author == User.FindFirst(ClaimTypes.NameIdentifier).Value)
- {
- filtered.Add(document);
- }
- else
- break;
- }
- filtered.Add(document);
- }
Jaimin ShethiyaPosted Mar 22, 2021, 4:53 AM
can you please try with below code.
let me know if you have any other doubts so will definetly help you.
Thanks
Satya KarkiPosted Mar 12, 2021, 5:50 PM
Rijwan AnsariPosted Mar 12, 2021, 5:46 PM
Sachin SinghPosted Mar 12, 2021, 10:38 AM