///////////////////////////////////////////////////////////////////////////////// #region [ Serialization Procedures ] public void SaveIntoFile(string filename) { if (VideoStore == null) { return; } Out.Begin(); ///////////////////////////////////////////////////////////////////////////// Out.Title("Serializing video store data..."); try { // To serialize data we must first open a stream for writing. // In this case, use a file stream. // using (FileStream fs = new FileStream(filename, FileMode.Create)) { VideoStore.Serialize(fs); } } catch (Exception ex) { Out.WriteLine(ex); } ///////////////////////////////////////////////////////////////////////////// Out.End(); }
private static void Strategy() { VideoStore videoStore = new VideoStore(); videoStore.Store("Graduation", new Mp4Compressor(), new BlackAndWhiteFilter()); videoStore.Store("Party", new AviCompressor(), new HighContrastFilter()); }
public IActionResult Get() { var videoStore = new VideoStore("Video Store Good Times"); _efCoreApiDbContext.VideoStores.Add(videoStore); _efCoreApiDbContext.SaveChanges(); return(Ok(videoStore)); }
public void VideoStoreSetup() { idtMock = Substitute.For <IDatateTime>(); Rental = new Rentals(idtMock); sut = new VideoStore(Rental); }
public void CreateUser(VideoStore.Business.Entities.User pUser) { using(TransactionScope lScope = new TransactionScope()) using (VideoStoreEntityModelContainer lContainer = new VideoStoreEntityModelContainer()) { lContainer.Users.AddObject(pUser); lContainer.SaveChanges(); lScope.Complete(); } }
static void Main(string[] args) { var date = new DateTimes(); var rentals = new Rentals(date); var VidStore = new VideoStore(rentals); VidStore.Movies = VidStore.FillMovieStorage(); SUTVideoStoreConsole VideoStore = new SUTVideoStoreConsole(VidStore, rentals); VideoStore.StarMenu(); }
public void Setup() { rentals = Substitute.For <IRentals>(); dateStub = Substitute.For <IDateTime>(); sut = new VideoStore(rentals); movie1 = new Movies() { Id = 0, Title = "Kalle Anka", Genre = "Animation" }; NotitleOnMovie = new Movies() { Id = 0, Title = "", Genre = "Comedy" }; customer1 = new Customer() { FirstName = "KallePer", movies = movie1, SSN = "1994-12-05" }; }
///////////////////////////////////////////////////////////////////////////////// public void LoadFromFile(string filename) { Out.Begin(); ///////////////////////////////////////////////////////////////////////////// Out.Title("Deserializing video store data..."); VideoStore = null; try { // Open the file containing the data that we want to deserialize. // using (FileStream fs = new FileStream(filename, FileMode.Create)) { VideoStore = VideoRentalOutlet.Deserialize(fs); } } catch (Exception ex) { Out.WriteLine(ex); } if (VideoStore == null) { return; } Out.WriteLine(VideoStore.FullInfo()); Out.WriteLine(VideoStore.MovieExemplars.FullInfo()); Out.WriteLine(VideoStore.Movies.FullInfo()); Out.WriteLine(VideoStore.Customers.FullInfo()); ///////////////////////////////////////////////////////////////////////////// Out.End(); }
protected override void OnStartup(StartupEventArgs e) { SimpleIoc.Default.Register <IDialogService>(() => new DialogService(new DialogLocator())); SimpleIoc.Default.Register <IVideoStore>(() => VideoStore.GetService()); SimpleIoc.Default.Register <IVideoClubRules>(() => new VideoClubRules()); }
static void Main(string[] args) { VideoStore videoStore = new VideoStore(); RentalsMovie rentalsMovie = new RentalsMovie(); int Choice = 0; while (Choice != 6) { Console.WriteLine(); Console.WriteLine(" välja nummer de alternativ"); Console.WriteLine("------------------------"); Console.WriteLine("1- Get Customers "); Console.WriteLine("2- Add New Custmors"); Console.WriteLine("3- Add New Movie"); Console.WriteLine("4- Rent Movie"); Console.WriteLine("5- Get Rentals For SSN"); Console.WriteLine("6- Exit"); try { Choice = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("Ogiltig markering. Vänligen returnera ditt val."); } Console.WriteLine("Du valde: " + Choice); switch (Choice) { case 1: var get = videoStore.GetCustomers(); get.ForEach(c => Console.WriteLine(c.Name, c.SSn)); Console.ReadLine(); break; case 2: Console.WriteLine("Enter Movie Title :"); var title = Console.ReadLine(); Console.WriteLine("Enter SSN :"); var ssn = Console.ReadLine(); videoStore.RegisterCustomer(title, ssn); break; case 3: Console.WriteLine("Write Movie Title"); var inp = Console.ReadLine(); Movie m = new Movie { MovieTitle = inp }; videoStore.AddMovie(m); break; case 4: Console.WriteLine("Enter Movie Title :"); var Mov = Console.ReadLine(); Console.WriteLine("Enter SSN :"); var ssnM = Console.ReadLine(); videoStore.RentMovie(Mov, ssnM); break; case 5: Console.WriteLine("Enter SSN :"); var ssnMRent = Console.ReadLine(); rentalsMovie.GetRentalsFor(ssnMRent); break; default: Console.WriteLine("Tryck Inter för att fortsätta......."); Console.ReadLine(); break; } Console.Clear(); } }
public VideoController(VideoStore store) { this.store = store; }
public Videos(VideoStore videoStore) { _videoStore = videoStore; }
public void CreateUser(VideoStore.Business.Entities.User pUser) { ServiceLocator.Current.GetInstance<IPublisherService>().Publish( VideoStore.Common.CommandFactory.Instance.GetEntityInsertCommand<User>(pUser) ); }
public void SetUp() { rentalMock = Substitute.For <IRentals>(); iDateTime = Substitute.For <IDateTime>(); sut = new VideoStore(rentalMock, iDateTime); }
public VideoHub(VideoStore videoStore) { this.videoStore = videoStore; }
static void Main(string[] args) { //För att vi kör dependency injection så skall vi ha det såhär var Call = new VideoStore(new RentedMovies(new MyDatTime())); }