Exemplo n.º 1
0
        public void FormatearYEnviar(institute ente, Formatter localFormatter, string nombre)
        {
            var rawString = $"{ente.CodigoInterno}:{ente.ContruirLLaveSecreta(nombre)}";

            rawString = localFormatter(rawString);

            Send(rawString);
        }
 public ActionResult EditInstitutionDetails(institute institute)
 {
     if (ModelState.IsValid)
     {
         db.Entry(institute).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("InstituteDashboard"));
     }
     else
     {
         return(View("Error"));
     }
 }
        public ActionResult Create([Bind(Include = "RegistrationID,InstitutionID,InstitutionName,Address,Ins_Password,Email,Contact,FavoritePet,FavoriteMovie,Luckynumber")] institute institute)
        {
            var institutionIDCheck = db.institutes.Where(x => x.InstitutionID == institute.InstitutionID).FirstOrDefault();

            if (institutionIDCheck == null)
            {
                if (ModelState.IsValid)
                {
                    db.institutes.Add(institute);
                    db.SaveChanges();
                    Session["InstitutionRegistration"] = "Registration Successful Please login...";
                    return(RedirectToAction("Login", "institutes"));
                }
            }
            else
            {
                ViewBag.InstitutionID = "ID already Exists";
            }
            return(View(institute));
        }
Exemplo n.º 4
0
        public void rutina1()
        {
            Console.WriteLine("Gestion de Institucion");
            var alumno1 = new Alumno("joel", "suarez")
            {
                Id = 1, Edad = 36, NickName = "JOEKS", Telefono = "22333222", Email = "*****@*****.**"
            };
            //alumno1.Nombre = "joel suarez";

            //var persona1 = new Persona() { Id = 1, Nombre = "Joel Suarez", Apellido = "suarez", Edad = 36, Telefono = "22333222" };
            var profesor = new Profesor()
            {
                Id = 1, Nombre = "Joel Suarez", Apellido = "suarez", Edad = 36, Telefono = "22333222", Catedra = "Matematicas"
            };

            Console.WriteLine("Virtual override");
            Console.WriteLine(profesor.ImprimirEdad);


            Persona a = profesor;
            Persona b = alumno1;

            Console.WriteLine("Foreach");
            Persona[] lista = new Persona[3];
            lista[0] = new Alumno("carlos", "ruiz")
            {
                Id = 1, Edad = 36, NickName = "JOEKS", Telefono = "22333222", Email = "*****@*****.**"
            };
            lista[1] = new Profesor()
            {
                Id = 2, Nombre = "miguel", Apellido = "suarez", Edad = 36, Telefono = "22333222", Catedra = "Matematicas"
            };
            lista[2] = new Profesor()
            {
                Id = 3, Nombre = "juvencio", Apellido = "sanchez", Edad = 36, Telefono = "22333222", Catedra = "Fisica"
            };

            foreach (Persona p in lista)
            {
                Console.WriteLine($"Tipo {p.GetType()}");
                Console.WriteLine(p.ConstruirResumen());

                institute ente = p;
                ente.ContruirLLaveSecreta("Hola");
            }

            a = b;
            Console.WriteLine(alumno1.Nombre);
            Console.WriteLine(Persona.ContadorPersona);

            Console.WriteLine("Resumenes");
            Console.WriteLine(alumno1.ConstruirResumen());
            Console.WriteLine(profesor.ConstruirResumen());

            Console.WriteLine("retornando valores por referencia");
            var anum = 15;

            Console.WriteLine(alumno1.RetornarVal(ref anum));
            Console.WriteLine(anum);

            Console.WriteLine("retornando valores sin referencia");
            Console.WriteLine(alumno1.RetornarValWReference(anum));
            Console.WriteLine(anum);
        }