public void Execute() { this.writer.Write(interfaceGenerator.CreateGeneralInstructions()); var studio = new Studio(); this.writer.Write(this.interfaceGenerator.Name()); studio.Name = this.reader.Read(); this.writer.Write(this.interfaceGenerator.YEstablished()); studio.YearEstablished = int.Parse(this.reader.Read()); this.writer.Write(this.interfaceGenerator.Trivia()); studio.Trivia = this.reader.Read(); this.writer.Write(this.interfaceGenerator.ToWhichFilm()); var filmTitle = this.reader.Read(); Film currentFilm; try { currentFilm = this.context.Films.Where(f => f.Title == filmTitle).First(); } catch (Exception) { throw new Exception("Film with this title can't found in the database"); } currentFilm.Studio = studio; this.context.SaveChanges(); this.writer.Write($"Studio {studio.Name} is added to movie: {filmTitle}."); }
public Film Create() { Console.WriteLine(interfaceGenerator.CreateGeneralInstructions()); Console.WriteLine(interfaceGenerator.Title()); string title = Console.ReadLine(); Console.WriteLine(interfaceGenerator.Genre()); string genreInput = Console.ReadLine(); Genre genre = (Genre)Enum.Parse(typeof(Genre), genreInput); var film = new Film(); film.Title = title; film.Genre = genre; return(film); }
public Actor Create() { Console.WriteLine(interfaceGenerator.CreateGeneralInstructions()); var actor = new Actor(); Console.WriteLine(interfaceGenerator.FName()); actor.FirstName = reader.Read(); Console.WriteLine(interfaceGenerator.LName()); actor.LastName = reader.Read(); Console.WriteLine(interfaceGenerator.YBorn()); actor.YearBorn = int.Parse(reader.Read()); Console.WriteLine(interfaceGenerator.SBio()); actor.ShortBio = reader.Read(); return(actor); }