public void AddMovie(Movy movie) { try { using (var context = new MediaEntities()) { context.Movies.Add(movie); context.SaveChanges(); } } catch (Exception e) { throw new Exception("Couldnt add to db", e); } }
public static void Edit(this Movy movie, string name) { try { using (var context = new MediaEntities()) { movie.Name = name; context.SaveChanges(); } } catch (Exception e) { throw new Exception("Could not save media", e); } }