コード例 #1
0
        public async Task <IActionResult> Index()
        {
            IEnumerable <TeamServicesDto> teamServicesView = (await lawyerDbContext.GetTeamServicesViewAsync())
                                                             .Where(m => m.LanguageId == DbContextService.GetLanguageIdByShortName(lawyerDbContext));

            return(View(teamServicesView));
        }
コード例 #2
0
        public async Task <IActionResult> Index([FromRoute] string culture)
        {
            IndexViewModel indexViewModel = null;

            try
            {
                int?languageId = DbContextService.GetLanguageIdByShortName(lawyerDbContext, culture);

                if (languageId == null)
                {
                    return(NotFound());
                }

                indexViewModel = new IndexViewModel
                {
                    Sliders = await lawyerDbContext.Sliders.ToListAsync(),

                    Areas = (await lawyerDbContext.GetAreaViewAsync())
                            .Where(m => m.LanguageId == languageId)
                            .ToList(),

                    Contact = (await lawyerDbContext.GetContactViewAsync())
                              .SingleOrDefault(m => m.LanguageId == languageId),

                    TeamService = (await lawyerDbContext.GetTeamServicesViewAsync())
                                  .SingleOrDefault(m => m.LanguageId == languageId)
                };
            }
            catch
            {
                return(NotFound());
            }

            return(View(indexViewModel));
        }