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

                usuario = Session["Usuario"] as Usuario;
                item    = TareaBl.Get((int)id);
                if (usuario.PerfilId == 1)
                {
                    ViewBag.ListaDeAreas = AreaBl.GetAll();
                }
                if (usuario.PerfilId == 2)
                {
                    ViewBag.ListaDeAreas = AreaBl.GetAll(usuario.EmpresaId);
                }
                ViewBag.ListaDeEstatusDeLaTarea = EstatusDeLaTareaBl.GetAll();

                return(View(item));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Create(Item item)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                Usuario usuario;
                usuario = Session["Usuario"] as Tarjetas.BusinessLayer.Dtos.Usuario;

                item.UsuarioId = usuario.Id;
                if (ModelState.IsValid)
                {
                    ItemBl.Add(item);
                    return(RedirectToAction($"Index/{item.TareaId}"));
                }
                else
                {
                    ViewBag.Tarea = TareaBl.Get(item.TareaId);
                    return(View(item));
                }
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
        // GET: Items/Create
        public ActionResult Create(int id)
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.Tarea = TareaBl.Get(id);

            return(View());
        }
示例#4
0
        // GET: UsuariosEnTarea/Index/{tareaId]
        public ActionResult Index(int id)
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            List <Usuario> lista;

            ViewBag.Tarea = TareaBl.Get(id);
            lista         = UsuarioBl.GetAllByTareaId(id);

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

            Tarea item;

            item = TareaBl.Get((int)id);

            return(View(item));
        }
示例#6
0
        // GET: UsuariosEnTarea/AddUserToTask/{tareaId}
        public ActionResult AddUserToTask(int id)
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            List <Usuario> lista;
            Tarea          tarea;
            Area           area;

            tarea           = TareaBl.Get(id);
            area            = AreaBl.Get(tarea.AreaId);
            lista           = UsuarioBl.GetAllByEmpresaId(area.EmpresaId);
            ViewBag.TareaId = id;

            return(View(lista));
        }