Exemple #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Room).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RoomExists(Room.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Room.Add(Room);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            Question.Room = await _context.Room.FirstOrDefaultAsync(m => m.ID == RoomID);

            Console.WriteLine(Question);
            _context.Question.Add(Question);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemple #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Vote = await _context.Vote.FindAsync(id);

            if (Vote != null)
            {
                _context.Vote.Remove(Vote);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }