Example #1
0
        public async Task OnGetAsync()
        {
            FizzBuzz = await _context.FizzBuzz.ToListAsync();

            FizzBuzz = _context.FizzBuzz.OrderByDescending(s => s.data).Take(20).ToList();
            await _context.SaveChangesAsync();

            //  FizzBuzzList = Ostatnie10.Sortowanie(FizzBuzzList);
            // FizzBuzz = FizzBuzzList;
            // FizzBuzz = await _context.FizzBuzz.ToListAsync();
        }
Example #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

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

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

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

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