Exemplo n.º 1
0
        public IActionResult Index()
        {
            var test  = _testimonialRepository.GetTestimonials();
            var model = _mapper.Map <IEnumerable <Testimonial>, IEnumerable <TestimonialVieModel> >(test);

            return(View(model));
        }
        public IViewComponentResult Invoke()
        {
            var testimonial = _testimonialRepository.GetTestimonials();

            var model = _mapper.Map <IEnumerable <Testimonial>, IEnumerable <TestimonialViewModel> >(testimonial);

            return(View(model));
        }
Exemplo n.º 3
0
        public List <CustomerTestimonialAggregate> GetCustomerTestimonials(bool?isAccepted, int pageNumber, int pageSize)
        {
            List <Testimonial> testimonials;
            var customerTestimonialAggregates = new List <CustomerTestimonialAggregate>();

            try
            {
                testimonials = _testimonialRepository.GetTestimonials(isAccepted, pageNumber, pageSize);
            }
            catch (Exception)
            {
                return(null);
            }
            var testimonialGroups = testimonials.GroupBy(t => t.CustomerId);
            ICustomerTestimonialAggregateFactory customerTestimonialAggregateFactory =
                new CutomerTestimonailAggregateFactory();

            foreach (var testimonialGroup in testimonialGroups)
            {
                customerTestimonialAggregates.Add(customerTestimonialAggregateFactory.CreateCustomerTestimonialAggregate(testimonialGroup));
            }
            return(customerTestimonialAggregates);
        }