public GetRelationshipResponse GetContactRelationship(int contactRelationMapID, int accountID) { GetRelationshipResponse response = new GetRelationshipResponse(); RelationshipViewModel viewModel = new RelationshipViewModel(); var dropdowns = cachingService.GetDropdownValues(accountID); ContactRelationship relationship = contactRelationshipRepository.FindBy(contactRelationMapID); IList <ContactRelationship> relationshipList = new List <ContactRelationship>(); relationshipList.Add(relationship); viewModel.Relationshipentry = Mapper.Map <IEnumerable <ContactRelationship>, IEnumerable <RelationshipEntry> >(relationshipList).ToList(); viewModel.RelationshipTypes = dropdowns.Where(s => s.DropdownID == (short)DropdownFieldTypes.RelationshipType).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive); response.RelationshipViewModel = viewModel; return(response); }
public GetRelationshipResponse GetContactRelationships(int contactID) { GetRelationshipResponse response = new GetRelationshipResponse(); RelationshipViewModel Relationship = new RelationshipViewModel(); Relationship.Relationshipentry = Mapper.Map <IEnumerable <ContactRelationship>, IEnumerable <RelationshipEntry> >(contactRelationshipRepository.FindContactRelationship(contactID)).ToList(); foreach (RelationshipEntry entry in Relationship.Relationshipentry) { if (entry.RelatedContactID == contactID) { entry.RelationshipTypeName = "Associated Contact"; entry.RelatedContact = entry.ContactName; entry.RelatedContactID = entry.ContactId; } } response.RelationshipViewModel = Relationship; return(response); }