Exemple #1
0
        public ActionResult Index()
        {
            ActionResult      paginaRedirect = null;
            IList <Prestamos> prestamos      = null;

            if (User.IsInRole("Admin"))
            {
                prestamos = pS.getAll();
            }
            else if (User.IsInRole("User"))
            {
                int codigo = (int)Session["idUsuario"];
                prestamos = pS.getPrestamosUsuario(codigo);
            }

            if (prestamos.Count() > 0)
            {
                ViewBag.Title  = "Listado de prestamos";
                paginaRedirect = View("Index", prestamos);
            }
            else
            {
                ViewBag.ErrorMessage = "No hay prestamos en la BB.DD";
                paginaRedirect       = View("Index", prestamos);
            }
            return(paginaRedirect);
        }
Exemple #2
0
        public ActionResult Index()
        {
            ActionResult      paginaRedirect = null;
            IList <Prestamos> prestamos      = prestamosService.getAll();

            if (prestamos.Count() > 0)
            {
                ViewBag.Title  = "Listado de prestamos";
                paginaRedirect = View("Index", prestamos);
            }
            else
            {
                ViewBag.ErrorMessage = "No hay prestamos en la BB.DD";
                paginaRedirect       = View("Index", prestamos);
            }
            return(paginaRedirect);
        }