public static void DeleteVideoGames(IList <int> ids) { foreach (var id in ids) { var gameToDelete = GetAll().FirstOrDefault(x => x.Id == id); VideoGamesRepository.Delete(gameToDelete); } }
public static void SaveRentalBroughtBacks(IList <VideoGame> games) { foreach (var game in games) { var gameFromRepo = GetAll().FirstOrDefault(x => x.Id == game.Id); gameFromRepo.Rented = game.Rented; VideoGamesRepository.AddOrUpdate(gameFromRepo); } }
public UnitOfWork(AppDbContext _context) { context = _context; VideoGames = new VideoGamesRepository(context); }
private static IEnumerable <VideoGame> GetAll() { return(VideoGamesRepository.GetAll()); }
public static void AddNewGameOrUpdate(VideoGame videoGame) { VideoGamesRepository.AddOrUpdate(videoGame); }