filter document elements by receiver
This commit is contained in:
parent
a4f7a163ea
commit
9efad346e1
@ -75,6 +75,8 @@ namespace EnvelopeGenerator.Web.Services
|
|||||||
throw new NullReferenceException("Receiver not found");
|
throw new NullReferenceException("Receiver not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
envelope.Documents = FilterElementsByReceiver(envelope, receiverId);
|
||||||
|
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Receiver = receiver,
|
Receiver = receiver,
|
||||||
@ -82,6 +84,18 @@ namespace EnvelopeGenerator.Web.Services
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<EnvelopeDocument> FilterElementsByReceiver(Envelope envelope, int receiverId)
|
||||||
|
{
|
||||||
|
return envelope.Documents.
|
||||||
|
Select((document) =>
|
||||||
|
{
|
||||||
|
var elements = document.Elements.Where((e) => e.ReceiverId == receiverId);
|
||||||
|
document.Elements = elements.ToList();
|
||||||
|
return document;
|
||||||
|
}).
|
||||||
|
ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public List<Envelope> LoadEnvelopes(int pReceiverId)
|
public List<Envelope> LoadEnvelopes(int pReceiverId)
|
||||||
{
|
{
|
||||||
return (List<Envelope>)envelopeModel.List(pReceiverId);
|
return (List<Envelope>)envelopeModel.List(pReceiverId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user