public Genre Update(Genre genre) { var gen = _context.Genres.FirstOrDefault(cp => cp.Id == genre.Id); if (gen == null) throw new ArgumentException(); _context.Entry(genre).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); return gen; }
public Genre Delete(Genre genre) { var gen = _context.Genres.Remove(genre); _context.SaveChanges(); return gen; }
public Genre Create(Genre genre) { var gen = _context.Genres.Add(genre); _context.SaveChanges(); return gen; }