Esempio n. 1
0
        public async Task <IEnumerable <PersonRelationshipModel> > Handle(GetPersonPersonRelationshipsQuery request, CancellationToken cancellationToken)
        {
            var relations = _unitOfWork.PersonRepository.GetAllPersonRelationships(new PersonRelationshipSpecification(request).ToExpression()).ToList();

            return
                (from r in relations
                 group r by new { r.MainPerson, r.PersonsRelationshipType } into g
                 select new PersonRelationshipModel
            {
                FirstName = g.Key.MainPerson.Name.Firstname,
                LastName = g.Key.MainPerson.Name.Lastname,
                RelationType = g.Key.PersonsRelationshipType.Name,
                Count = g.Count()
            });
        }
Esempio n. 2
0
 public PersonRelationshipSpecification(GetPersonPersonRelationshipsQuery filter)
 {
     _filter = filter;
 }