Lerokaa / Lab2

2 stars 0 forks source link

Изучить гайд и сделать свою работу #35

Open Arhenon opened 1 month ago

Arhenon commented 1 month ago

https://docs.google.com/document/d/1yHu9w-M_CA60GI_br0A4YqN2TjwAnarfYTVuVBx9cAA/edit?usp=sharing

Arhenon commented 1 month ago

public static Classroom CreateClassroom() { Console.WriteLine("Введите название аудитории: "); string name = Console.ReadLine();

        Classroom classroom = DB.Classrooms.FirstOrDefault<Classroom>(cl => cl.Name == name);
        if(classroom == null) 
        {
            Console.WriteLine("Введите количество мест?");
            int seatingCapacity;
            while (!int.TryParse(Console.ReadLine(), out seatingCapacity) || seatingCapacity < 0)
                Console.WriteLine("Нужно ввести целое число =>0");
            Console.WriteLine("Введите количество окон?");
            int windowCount;
            while (!int.TryParse(Console.ReadLine(), out windowCount) || windowCount < 0)
                Console.WriteLine("Нужно ввести целое число =>0");
            Console.WriteLine("Введите количество оборудования:");
            int equipmentCount;
            while (!int.TryParse(Console.ReadLine(), out equipmentCount) || equipmentCount < 0)
                Console.WriteLine("Нужно ввести целое число =>0");
            List<Equipment> equipmentList = new List<Equipment>();
            for (int i = 0; i < equipmentCount; i++)
            {
                Console.WriteLine("Создайте оборудование:");
                equipmentList.Add(CreateEquipment());
            }
            Console.WriteLine("Введите ответственного сотрудника: ");
            Employee employee = CreateEmployee();

            classroom = new Classroom(name, employee, seatingCapacity, windowCount);
            foreach (Equipment equipment in equipmentList)
            {
                classroom.Equipments.Add(equipment);
            }
            DB.Classrooms.Add(classroom);

        }
        return classroom;

    }

    public static Equipment CreateEquipment()
    {
        return null;
    }
    public static Employee CreateEmployee()
    {
        return null;
    }