Exemple #1
0
        public async Task <IActionResult> Index()
        {
            var cities = await _repo.GetKsacities();

            var dto = new TrackDto();

            dto.Ksacities = cities;
            return(View(dto));
        }
        public async Task <IActionResult> Index()
        {
            var cities = await _repo.GetKsacities();

            var userComents = await _repo.GetComments();

            var averageRate = await _repo.GetAverageRate();

            var totalCount = await _repo.GetCommentCount();

            var reviewDto = new ReviewDto
            {
                ServiceDto = new RequestedServiceDto
                {
                    Ksacities = cities.Select(a => new cityDto
                    {
                        Id   = a.Id,
                        Name = a.Name
                    }).ToList()
                },
                UserComments = userComents.Select(a => new UserCommentsDto
                {
                    CommentDate      = a.CommentDate,
                    CommentText      = a.CommentText,
                    Rating           = a.Rating,
                    UserEmail        = a.UserEmail,
                    UserFullName     = a.UserFullName,
                    RequestServiceId = a.RequestServiceId
                }).ToList(),
                AvaregRate = (int)averageRate,
                TotalRates = totalCount
            };

            return(View(reviewDto));
        }