public async Task <IActionResult> Edit(int id, [Bind("StartDate,EndDate,Id")] Repertoire repertoire) { if (id != repertoire.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(repertoire); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RepertoireExists(repertoire.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(repertoire)); }
/// <summary> /// returns a list of repository in a given parent directory /// </summary> /// <param name="rep"></param> /// <returns></returns> public List <Element> GetRepertoires(Environment.SpecialFolder rep) { string docPath = Environment.GetFolderPath(rep); List <Element> myRep = new List <Element>(); DirectoryInfo diTop = new DirectoryInfo(docPath); long taille = 0; try { foreach (var reps in diTop.EnumerateDirectories("*", SearchOption.AllDirectories)) { foreach (var fi in reps.EnumerateFiles("*", SearchOption.AllDirectories)) { taille += fi.Length; var r = new Repertoire(reps.FullName, taille); myRep.Add(r); } } } catch (UnauthorizedAccessException unAuthSubDir) { Console.WriteLine($"unAuthSubDir: {unAuthSubDir.Message}"); } return(myRep); }
public RepertoireInfoForm(Repertoire repertoireToEdit) { InitializeComponent(); repertoire = repertoireToEdit; textBox1.Text = repertoire.LocationName; foreach (var performance in repertoireToEdit.Performances) { performancesListBox.Items.Add(performance); } }
public static void LoadAndPrintOutRepertoireFromFile() { IFormatter formatter = new BinaryFormatter(); Stream openingStream = new FileStream("Repertuar.bin", FileMode.Open, FileAccess.Read); Repertoire RepertuarWczytany = (Repertoire)formatter.Deserialize(openingStream); openingStream.Close(); Console.WriteLine(RepertuarWczytany.ToString()); }
public async Task <IActionResult> Create([Bind("StartDate,EndDate,Id")] Repertoire repertoire) { if (ModelState.IsValid) { _context.Add(repertoire); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(repertoire)); }
public RepertoireUtilisateurTest() { _repertoireUtilisateur = new Repertoire <Utilisateur>(); usr = new Utilisateur { Pseudo = "TEST", Email = "*****@*****.**", AuthCode = "TESTTESTTEST", LastModif = DateTime.Now, DateCrea = DateTime.Now }; }
public async Task <IActionResult> OnGetAsync(long?id) { if (id == null) { return(NotFound()); } Repertoire = await _context.Repertoire.FirstOrDefaultAsync(m => m.ID == id); if (Repertoire == null) { return(NotFound()); } return(Page()); }
static void Main(string[] args) { Repertoire mere = new Repertoire("Mere", "C:\\"); Fichier fichier1 = new Fichier("test", ".txt"); mere.Add(fichier1); Repertoire filsRep = new Repertoire("Fils"); mere.Add(filsRep); Raccourcie raccourcie1 = new Raccourcie("racoucieFils", filsRep); filsRep.Add(raccourcie1); Console.WriteLine(filsRep.Chemin()); }
public async Task <IActionResult> OnPostAsync(long?id) { if (id == null) { return(NotFound()); } Repertoire = await _context.Repertoire.FindAsync(id); if (Repertoire != null) { _context.Repertoire.Remove(Repertoire); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public static IList <Repertoire> ReadEntitiesFrom(string path) { var readingResult = new List <Repertoire>(); try { using (var fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite)) { using (var reader = XmlReader.Create(fs)) { if (reader.EOF) { return(readingResult); } reader.Read(); if (reader.IsEmptyElement) { return(readingResult); } while (reader.Read()) { if (reader.IsStartElement() && reader.Name.Equals("Repertoire")) { var repertoire = new Repertoire(); repertoire.ReadXml(reader); readingResult.Add(repertoire); } if (reader.Name.Equals("Repertoires")) { break; } } } } } catch (IOException ex) { MessageBox.Show(Messages.FILE_READING_EXCEPTION + "\nДеталі помилки: " + ex.Message); } return(readingResult); }
public RepertoireCoursTest() { _repertoireCours = new Repertoire <Cours>(); }
public RepertoireCoursModuleTest() { _repertoireCoursModule = new Repertoire <CoursModule>(); }
public RepertoireInfoForm() { InitializeComponent(); repertoire = new Repertoire(); }
private static void SeedEnumerations(ISAContext context) { for (var i = 0; i < 3; i++) { var dummyUser = new UserProfile { City = $"City{i}", EmailAddress = $"test{i}@test.mail", FirstName = $"FirstName{i}", LastName = $"LastName{i}", TelephoneNr = $"{i}{i}{i}{i}{i}{i}{i}" }; if (context.UserProfiles.All(u => u.EmailAddress != dummyUser.EmailAddress)) { context.UserProfiles.Add(dummyUser); } } context.SaveChanges(); var twoUsers = context.UserProfiles.Take(2); var firstUser = twoUsers.First(); var secondUser = twoUsers.Skip(1).Take(1).First(); if (context.FriendRequests.All(r => r.SenderId != firstUser.Id && r.ReceiverId != secondUser.Id)) { context.FriendRequests.Add(new FriendRequest { Sender = firstUser, Receiver = secondUser, Status = FriendshipStatus.Pending }); } var projection = new Projection { Description = "desc", Duration = new System.TimeSpan(2, 0, 0), Name = "Projection 1", Type = ProjectionTypeEnum.Movie }; var rep = new Repertoire { Projections = new List <Projection> { projection } }; var cinema = new Cinema { Address = "Address1", Name = "Cinema1", Type = DataAccess.Models.Enumerations.CinemaTypeEnum.Cinema, Repertoires = new List <Repertoire> { rep } }; var theater = new Theater() { Name = "Pozoriste Mladih" }; var funZone = new FunZone() { Cinema = cinema }; var funZoneTheater = new FunZone() { Theater = theater }; var starWarsProps = new ThematicProps() { FunZone = funZone, Description = "An almost brand new thematic prop for star wars! Used couple of times!", Image = @"~/images/sw1.jpg", Price = 1000, Name = "Star wars gear", Publisher = firstUser }; var starTreckProp = new ThematicProps() { FunZone = funZone, Description = "An almost brand new thematic prop for star treck! Used couple of times!", Image = @"~/images/st1.jpg", Price = 2000, Name = "Star treck terminal" }; var lotrProp = new ThematicProps() { FunZone = funZone, Description = "An almost brand new thematic prop for LOTR! Used couple of times!", Image = @"~/images/lordOfRings_ring.jpg", Price = 200000, Name = "LOTR ring on sales" }; context.ThematicProps.Add(starWarsProps); context.ThematicProps.Add(starTreckProp); context.ThematicProps.Add(lotrProp); context.Projections.Add(projection); context.Repertoires.Add(rep); context.Cinemas.Add(cinema); context.FunZone.Add(funZone); context.FunZone.Add(funZoneTheater); context.SaveChanges(); }
/// <summary> /// Add repertoire to database /// </summary> /// <param name="repertoire"></param> public void AddRepertoire(Repertoire repertoire) { _context.Repertoires.Add(repertoire); }