Exemplo n.º 1
0
        // GET: MyReserve
        public ActionResult Search()
        {
            if (Session["Login"] == "NO LOGEADO")
            {
                return(RedirectToAction("IniciarSesion", "Account", new { id = 2 }));
            }

            string nombre = Session["Login"].ToString();

            Apoderado apo  = new Apoderado();
            Apoderado apod = apo.BuscarApoderado(nombre);

            if (apod != null)
            {
                ViewBag.RutApoderado = apod.Rut;
                ViewBag.Listar       = "Listar";

                Reserve        re  = new Reserve();
                List <Reserve> res = re.ListarReserva(ViewBag.RutApoderado);

                DateTime thisDay = DateTime.Today;
                string   dia_hoy = thisDay.ToString("d");
                //15-06-2019
                string yyyy = dia_hoy.Substring(6, 4);
                string mm   = dia_hoy.Substring(3, 2);
                string dd   = dia_hoy.Substring(0, 2);
                ViewBag.dia_hoy        = yyyy + "-" + mm + "-" + dd;
                @ViewBag.No_Encontrado = "Encontrado";

                return(View(res));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }