public async Task Remover(long id) { var usuario = await _context.Usuario.FirstOrDefaultAsync(x => x.Id == id); if (usuario == null) { _notification.AddNotification("Usuário", "Usuário não foi encontrado"); return; } _context.Remove(usuario); await _context.SaveChangesAsync(); }
public async Task Remover(long id) { var jogo = await _context.Jogo.FirstOrDefaultAsync(x => x.Id == id); if (jogo == null) { _notification.AddNotification("Jogo", "Jogo não foi encontrado"); return; } _context.Remove(jogo); await _context.SaveChangesAsync(); }
public async Task Remover(long id) { var amigo = await _context.Amigo.Include(x => x.Emprestimos).ThenInclude(x => x.Jogo) .FirstOrDefaultAsync(x => x.Id == id); if (amigo == null) { _notification.AddNotification("Amigo", "Amigo não foi encontrado"); return; } amigo.FinalizarTodosEmprestimo(); _context.Remove(amigo); await _context.SaveChangesAsync(); }
public async Task Remover(long id) { var emprestimo = await _context.Emprestimo.Include(x => x.Jogo) .Include(x => x.Amigo) .FirstOrDefaultAsync(x => x.Id == id); if (emprestimo == null) { _notification.AddNotification("Emprestimo", "Emprestimo não foi encontrado"); return; } emprestimo.Jogo.Disponibilizar(); _context.Remove(emprestimo); await _context.SaveChangesAsync(); }