예제 #1
0
        public ActionResult editarCategoria(long?editID)
        {
            if (Session["USER_ID"] != null)
            {
                if (editID != null)
                {
                    long userId  = (long)Session["USER_ID"];
                    user curUser = entities.users.Find(userId);
                    List <ShowMessage>        pubMessageList = ep.GetChatMessages(userId);
                    category                  editCat        = entities.categories.Find(editID);
                    categoriesTareasViewModel viewModel      = new categoriesTareasViewModel();
                    viewModel.side_menu     = "suplidores";
                    viewModel.side_sub_menu = "category_directory";

                    viewModel.categ          = editCat;
                    viewModel.curUser        = curUser;
                    viewModel.pubTaskList    = ep.GetNotifiTaskList(userId);
                    viewModel.pubMessageList = pubMessageList;
                    viewModel.messageCount   = ep.GetUnreadMessageCount(pubMessageList);
                    return(View(viewModel));
                }
                else
                {
                    return(Redirect(Url.Action("NotFound", "Error")));
                }
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }
예제 #2
0
        //Categorias

        public ActionResult listadoCategorias(string Error, string searchStr = "")
        {
            if (Session["USER_ID"] != null)
            {
                long userId  = (long)Session["USER_ID"];
                user curUser = entities.users.Find(userId);
                List <ShowMessage> pubMessageList = ep.GetChatMessages(userId);
                List <category>    catList        = new List <category>();

                long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]);

                if (searchStr == "")
                {
                    var query = (from r in entities.categories select r);
                    catList = query.ToList();
                }
                else
                {
                    var query1 = (from r in entities.categories
                                  where
                                  r.name.Contains(searchStr) == true
                                  select r);
                    catList = query1.ToList();
                }

                categoriesTareasViewModel viewModel = new categoriesTareasViewModel();
                viewModel.side_menu     = "suplidores";
                viewModel.side_sub_menu = "category_directory";

                viewModel.categoryList   = catList;
                viewModel.searchStr      = searchStr;
                viewModel.curUser        = curUser;
                viewModel.pubMessageList = pubMessageList;
                viewModel.messageCount   = ep.GetUnreadMessageCount(pubMessageList);
                viewModel.pubTaskList    = ep.GetNotifiTaskList(userId);
                ViewBag.msgError         = Error;
                return(View(viewModel));
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }