public ActionResult listado() { if (Session["USER_ID"] != null) { try { long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]); long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); List <emailtheme> emailthemeList = entities.emailthemes.Where(m => m.user_id == userId).ToList(); listadoPlantillasViewModel viewModel = new listadoPlantillasViewModel(); List <PlantillaItemViewModel> list = new List <PlantillaItemViewModel>(); foreach (var item in emailthemeList) { PlantillaItemViewModel plantillaItemViewModel = new PlantillaItemViewModel(); int typeID = item.type_id; emailtype emailtype = entities.emailtypes.Find(typeID); plantillaItemViewModel.TypeID = typeID; plantillaItemViewModel.TypeName = emailtype.represent; plantillaItemViewModel.Content = item.htmcontent; plantillaItemViewModel.ID = item.id; list.Add(plantillaItemViewModel); } communityList = ep.GetCommunityList(userId); viewModel.communityList = communityList; viewModel.side_menu = "plantillas"; viewModel.side_sub_menu = "plantillas_listado"; viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList(); viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.curUser = curUser; viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); viewModel.list = list; return(View(viewModel)); } catch (Exception ex) { return(Redirect(Url.Action("Index", "Error"))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
// GET: webmaster/plantillas public ActionResult listado() { if (Session["USER_ID"] != null) { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); List <emailtheme> emailthemeList = entities.emailthemes.Where(m => m.user_id == userId).ToList(); listadoPlantillasViewModel viewModel = new listadoPlantillasViewModel(); List <PlantillaItemViewModel> list = new List <PlantillaItemViewModel>(); foreach (var item in emailthemeList) { PlantillaItemViewModel plantillaItemViewModel = new PlantillaItemViewModel(); int typeID = item.type_id; emailtype emailtype = entities.emailtypes.Find(typeID); plantillaItemViewModel.TypeID = typeID; plantillaItemViewModel.TypeName = emailtype.represent; plantillaItemViewModel.Content = item.htmcontent; plantillaItemViewModel.ID = item.id; list.Add(plantillaItemViewModel); } viewModel.side_menu = "plantillas"; viewModel.side_sub_menu = "plantillas_listado"; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.curUser = curUser; viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); viewModel.list = list; return(View(viewModel)); } else { return(Redirect(ep.GetLogoutUrl())); } }