Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email")] Subscriber subscriber)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subscriber);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(subscriber));
        }
        public async Task <IActionResult> DeleteBoard(int id)
        {
            var board = await _context.Boards.Where(b => b.Id == id).FirstOrDefaultAsync();

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

            _context.Boards.Remove(board);
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <IActionResult> DeleteUser(string pseudo)
        {
            var user = await _context.Users.Where(u => u.Pseudo == pseudo).FirstOrDefaultAsync();

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

            _context.Users.Remove(user);
            await _context.SaveChangesAsync();

            return(NoContent());
        }