public void Add <T>(T entity) where T : class { Noticia noticia = entity as Noticia; Autor autor = _context.Autores.Where(a => a.Id == noticia.Autor.Id).FirstOrDefault(); if (autor == null) { autor = new Autor(noticia.Autor.Nome); } noticia.Autor = autor; _context.Add(entity); }
public void Add <T>(T entity) where T : class { _context.Add(entity); }