Esempio n. 1
0
        public IEnumerable <OpportunityViewModel> GetAllOpportunitiesByOwner(int[] ownerId, DateTime startDate, DateTime endDate)
        {
            Logger.Current.Verbose("Request for get the opportunities for selected owner.");

            IEnumerable <Opportunity> opportunities = opportunityRepository.FindAllByOwner(ownerId, startDate, endDate).ToList();

            foreach (var opportunity in opportunities)
            {
                opportunity.Contacts = opportunityRepository.GetRelatedContacts(opportunity.Id);
            }
            IEnumerable <OpportunityViewModel> opportunityList = Mapper.Map <IEnumerable <Opportunity>, IEnumerable <OpportunityViewModel> >(opportunities);

            return(opportunityList);
        }