// GET: Registrado
        public ActionResult Index()
        {
            NotificacionCEN        NotificacionCEN      = new NotificacionCEN();
            IList <NotificacionEN> listNotiEN           = NotificacionCEN.ReadAll(0, -1);
            IEnumerable <NotificacionViewModel> listreg = new AssemblerNotificacion().ConvertListENToModel(listNotiEN);

            return(View(listreg));
        }
        // GET: Registrado/Details/5
        public ActionResult Details(int id)
        {
            NotificacionCEN       NotificacionCEN = new NotificacionCEN();
            NotificacionEN        notiEN          = NotificacionCEN.ReadOID(id);
            NotificacionViewModel notiVM          = new AssemblerNotificacion().ConvertENToModelUI(notiEN);

            return(View(notiVM));
        }
        // GET: Registrado/Edit/5
        public ActionResult Edit(int id)
        {
            NotificacionViewModel noti = null;

            SessionInitialize();
            NotificacionEN notiEN = new NotificacionCAD(session).ReadOIDDefault(id);

            noti = new AssemblerNotificacion().ConvertENToModelUI(notiEN);
            SessionClose();

            return(View(noti));
        }
        // GET: Registrado/Delete/5
        public ActionResult Delete(int id)
        {
            try
            {
                SessionInitialize();
                NotificacionCAD       notiCAD = new NotificacionCAD(session);
                NotificacionCEN       cen     = new NotificacionCEN(notiCAD);
                NotificacionEN        notiEN  = cen.ReadOID(id);
                NotificacionViewModel noti    = new AssemblerNotificacion().ConvertENToModelUI(notiEN);

                SessionClose();


                return(View(noti));
            }
            catch
            {
                //Meter aqui el mensaje de error
                return(View());
            }
        }
        // GET: Registrado/MisNotificaciones
        public ActionResult MisNotificaciones()
        {
            NotificacionCEN notcen = new NotificacionCEN();

            //IList<ReservaEN> listresFinalizadasEN;
            IList <NotificacionEN> listresNoFinalizadasEN;

            UsuarioCEN usu   = new UsuarioCEN();
            int        idd   = usu.DgetOIDfromEmail(User.Identity.Name);
            UsuarioEN  usuen = usu.ReadOID(idd);

            RestauranteCEN resview = new RestauranteCEN();

            ViewData["resview"] = resview;

            //Console.Write("\n"+idd+"\n");
            String[] tipo = usuen.GetType().ToString().Split('.');
            if (tipo[tipo.Length - 1].Equals("RestauranteEN"))
            {
                //listresFinalizadasEN = rescen.GetReservasFromRestauranteFinal(1048576, true);
                listresNoFinalizadasEN = notcen.ReadAll(0, -1);

                IList <NotificacionEN> auxNotEN = notcen.ReadAll(0, -1);
                foreach (NotificacionEN e in listresNoFinalizadasEN)
                {
                    try
                    {
                        if (e.Usuario.Id != idd || e.Enviada)
                        {
                            auxNotEN.Remove(e);
                        }
                    }
                    catch { }
                }

                //IEnumerable<ReservaViewModel> listres = new AssemblerReserva().ConvertListENToModel(listresFinalizadasEN);
                IEnumerable <NotificacionViewModel> listres2 = new AssemblerNotificacion().ConvertListENToModel(auxNotEN);
                return(View(listres2));
            }
            else if (tipo[tipo.Length - 1].Equals("RegistradoEN"))
            {
                //listresFinalizadasEN = rescen.GetReservasFromRestauranteFinal(1048576, true);
                listresNoFinalizadasEN = notcen.ReadAll(0, -1);

                IList <NotificacionEN> auxNotEN = notcen.ReadAll(0, -1);
                foreach (NotificacionEN e in listresNoFinalizadasEN)
                {
                    try
                    {
                        if (e.Usuario.Id != idd || e.Enviada)
                        {
                            auxNotEN.Remove(e);
                        }
                    }
                    catch { }
                }

                //IEnumerable<ReservaViewModel> listres = new AssemblerReserva().ConvertListENToModel(listresFinalizadasEN);
                IEnumerable <NotificacionViewModel> listres2 = new AssemblerNotificacion().ConvertListENToModel(auxNotEN);
                return(View(listres2));
            }

            return(View());
            //return View(listres);
        }