private static void ExcluirSerie() { Console.WriteLine("Excluir séries "); Console.Write("Digite o id da série: "); int entradaId = int.Parse(Console.ReadLine()); repository.Delete(entradaId); }
private static void DeleteSerie() { int id; Console.WriteLine("Delete series"); Console.Write("Enter the series id: "); if (!(int.TryParse(Console.ReadLine(), out id) && id < repository.NextId())) { Console.WriteLine(); Console.WriteLine("- Invalid id, try again."); return; } repository.Delete(id); }
public static void Delete(int id) { if (id <= 0) { throw new MediaManagerException($"Erreur : {nameof(id)} <= 0", ExceptionReturnType.Error); } try { using (var context = new MediaManagerContext()) using (var repository = new SerieRepository(context)) { repository.Delete(id); context.SaveChanges(); } } catch (Exception ex) { throw new MediaManagerException($"Erreur : {ex.Message}", ExceptionReturnType.Error); } }
public void Delete(Guid id) { _serieRepository.Delete(id); }