as I can add the option to modify is the only one that I need and I can not think of anything

0

I'm missing the option to modify the data student who is registered I have to enter the document and modify your name surname and date of birth but I can not think of anything since thank you very much

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abm
{
    class Program

    {


        static void Main(string[] args)

        {

            List<Alumno> Alumnolista = new List<Alumno>();



            int opcion = 0;


            do
            {
                Console.Clear();
                Console.WriteLine("bienvenido, elija una opción " + "\n");
                Console.Write("1º) Alta" + "\n" + "2º) Baja" + "\n" + "3º) Modificar" + "\n" + "4º) Consultar" + "\n");

                string entrykey = Console.ReadLine();
                if (!int.TryParse(entrykey, out opcion))
                {
                    opcion = 0;
                }

                switch (opcion)
                {
                    case 1:




                        Alumno objalumno;
                        objalumno = new Alumno();
                        Console.WriteLine("Ingrese el Nombre del alumno");
                        objalumno.Nombre = Console.ReadLine();
                        Console.WriteLine("Ingrese el Apellido del alumno");
                        objalumno.Apellido = Console.ReadLine();
                        Console.WriteLine("Ingrese el Documento del Alumno");

                        try
                        {
                            objalumno.Documento = int.Parse(Console.ReadLine());
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("El documento debe ser un entero");
                            //Tratar excepción como se desee (salir, añadir documento por defecto o lo que quieras hacer)
                        }

                        Console.WriteLine("Ingrese la fecha de nacimiento con formato (dd/mm/yyyy)");
                        try
                        {
                            objalumno.FechaNacimiento = DateTime.Parse(Console.ReadLine());
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("La fecha debe tener el formato (dd/mm/yyyy)");
                            //Tratar excepción como se desee (salir, añadir fecha por defecto o lo que quieras hacer)
                        }



                        Alumnolista.Add(objalumno);
                        Console.WriteLine("Alumno registrado\nPulse una tecla para continuar");



                        break;
                    case 2:
                        Console.Write("Ingrese el Documento del Alumno que desea eliminar");

                       int alumeliminaar = int.Parse (Console.ReadLine());

                        Alumnolista.RemoveAll(a => a.Documento == alumeliminaar);

                        Console.WriteLine("Alumno eliminado");

                        break;
                    case 3:
                        Console.Write("Modificar..");
                        // Continuar lógica y extraer métodos //
                        break;
                    case 4:
                        Console.Clear();
                        Console.WriteLine("Ingrese el Documento del Alumno que desea buscar");

                        objalumno = new Alumno();
                        int Documentobusc = int.Parse (Console.ReadLine());



                        foreach (Alumno a in Alumnolista)
                        {
                            if (Documentobusc == a.Documento)
                            { Console.WriteLine(a.inscripción()); }
                        }
                        Console.ReadKey();
                        // Continuar lógica y extraer métodos //
                        break;


                }
                Console.ReadKey();


            } while (opcion != 5);


        }
    }
}

the class just in case

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abm
{
    public class Alumno
    {
        public string Nombre
        { get; set; }
        public string Apellido
        { get; set; }
        public int Documento
        { get; set; }


        public int Opción
        { get; set; }
        public DateTime FechaNacimiento
        { get; set; }


        public string inscripción()
        {
            return "El Alumno " +  this.Nombre  + this.Apellido + " fue inscripto/nPulse una tecla para continuar : ";
        }
    }

}
    
asked by Facundo Paez 14.09.2018 в 06:30
source

0 answers