public ActionResult Edit(Area area)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                if (ModelState.IsValid)
                {
                    AreaBl.Update(area);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();
                    return(View(area));
                }
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(Area item)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                item.UsuarioId = (Session["Usuario"] as Usuario).Id;
                if (ModelState.IsValid)
                {
                    AreaBl.Add(item);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();
                    return(View(item));
                }
            }
            catch
            {
                return(View());
            }
        }
        // GET: Usuarios/Create
        public ActionResult Create()
        {
            ViewBag.ListaDePerfiles = PerfilBl.GetAll();
            ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();

            return(View());
        }
        public ActionResult Inactivos()
        {
            List <EmpresaDto> lista;

            lista = EmpresaBl.GetAll(false);

            return(View("Index", lista));
        }
        // GET: EmpresaController
        public ActionResult Index()
        {
            List <EmpresaDto> lista;

            lista = EmpresaBl.GetAll();

            return(View(lista));
        }
        // GET: Areas/Create
        public ActionResult Create()
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();

            return(View());
        }
        // GET: Usuarios/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id is null)
            {
                return(RedirectToAction("Index"));
            }

            Usuario item;

            ViewBag.ListaDePerfiles = PerfilBl.GetAll();
            ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();
            item = UsuarioBl.Get((int)id);

            return(View(item));
        }
        // GET: Areas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id is null)
            {
                return(RedirectToAction("Index"));
            }

            Area item;

            item = AreaBl.Get((int)id);
            ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();

            return(View(item));
        }
 public ActionResult Edit(Usuario item)
 {
     try
     {
         if (ModelState.IsValid)
         {
             UsuarioBl.Update(item);
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.ListaDePerfiles = PerfilBl.GetAll();
             ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();
             return(View(item));
         }
     }
     catch
     {
         return(View());
     }
 }
Example #10
0
 public JsonResult Listado()
 {
     return(Json(new { data = _bl.GetAll() }, JsonRequestBehavior.AllowGet));
 }