Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            IEnumerable <AreaDto> areaViews = (await lawyerDbContext.GetAreaViewAsync())
                                              .Where(m => m.LanguageId == DbContextService.GetLanguageIdByShortName(lawyerDbContext));

            return(View(areaViews));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create()
        {
            TeamMemberViewModel teamMemberViewModel = new TeamMemberViewModel
            {
                Languages = await lawyerDbContext.Languages
                            .AsNoTracking()
                            .ToListAsync(),
                Areas = (await lawyerDbContext.GetAreaViewAsync())
                        .Where(m => m.LanguageId == DbContextService.GetLanguageIdByShortName(lawyerDbContext)).ToList()
            };

            return(View(teamMemberViewModel));
        }