Beispiel #1
0
        public async Task <IActionResult> Edit(Guid id)
        {
            var model = await _database
                        .Events
                        .Include(e => e.Questions)
                        .ThenInclude(q => q.Options)
                        .AsNoTracking()
                        .Expressionify()
                        .Select(e => QuestionsModel.Create(e, "all"))
                        .SingleOrDefaultAsync(s => s.EventId == id);

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> Index(Guid id, string filter = "all")
        {
            var model = await _database
                        .Events
                        .Include(e => e.Questions)
                        .ThenInclude(q => q.Options)
                        .ThenInclude(s => s.Answers)
                        .ThenInclude(a => a.Signup)
                        .ThenInclude(s => s.User)
                        .AsNoTracking()
                        .Expressionify()
                        .Select(e => QuestionsModel.Create(e, filter))
                        .SingleOrDefaultAsync(s => s.EventId == id);

            return(View(model));
        }