Czempina

Untitled

Nov 5th, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using StudentManager.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5.  
  6. namespace StudentManager.Operations
  7. {
  8.     class NewStudent
  9.     {
  10.         private StudentFileManager StudentFileManager = new StudentFileManager();
  11.         public void AddStudent()
  12.         {
  13.             List<Student> student = new List<Student>();
  14.  
  15.             student = StudentFileManager.Load();
  16.  
  17.             Console.Clear();
  18.  
  19.             Console.WriteLine("Podaj imię ucznia: ");
  20.             string FName = Console.ReadLine();
  21.  
  22.             Console.WriteLine("Podaj imię ucznia: ");
  23.             string LName = Console.ReadLine();
  24.  
  25.             Console.WriteLine("Podaj pesel ucznia: ");
  26.             string Pesel = Console.ReadLine();
  27.  
  28.             Console.WriteLine("Podaj wiek ucznia: ");
  29.             string Age = Console.ReadLine();
  30.  
  31.             Student newStudent = new Student
  32.             {
  33.                 FirstName = FName,
  34.                 LastName = LName,
  35.                 Pesel = Pesel,
  36.                 Age = Convert.ToInt32(Age)
  37.             };
  38.             student.Add(newStudent);
  39.  
  40.             StudentFileManager.Save(student);
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment