// // GET: /PagesAdmin/Attach/ /// <summary> /// 列表 /// </summary> /// <returns></returns> public ActionResult List() { if (Request.HttpMethod.ToUpper() == "POST") { if (CECRequest.GetFormString("action").ToLower() == "del") { //删除 int id = CECRequest.GetFormInt("id", 0); AttachmentService.Delete(id); } } int catId = CECRequest.GetQueryInt("catId", 0); if (catId == 0) { catId = Elco.Config.GeneralConfig.DownloadRootId_DE; } var list = AttachmentService.List(new AttachmentSearchSetting() { PageIndex = CECRequest.GetQueryInt("page", 1), PageSize = 15, CategoryId = catId }); ViewBag.List = list; return(View()); }
public ActionResult SetPublishStatus() { int id = CECRequest.GetFormInt("id", 0); bool status = ArticleService.SetPublishStatus(id, true); //设置为发布 return(Json(new { Status = status })); }
public ActionResult List() { if (Request.HttpMethod.ToUpper() == "POST") { if (CECRequest.GetFormString("action").ToLower() == "del") { //删除 int id = CECRequest.GetFormInt("id", 0); JobService.Delete(id); } if (CECRequest.GetFormString("action").ToLower() == "pub") { //发布 int id = CECRequest.GetFormInt("id", 0); JobService.SetPublish(id, true); } } var list = JobService.List(new JobSearchSetting() { PageSize = 15, PageIndex = CECRequest.GetQueryInt("page", 1), IsOnlyShowPublished = false //false 全部显示 }); ViewBag.List = list; return(View()); }
/// <summary> /// 管理员列表 /// </summary> /// <returns></returns> public ActionResult AdminList() { if (Request.HttpMethod.ToUpper() == "POST") { string _action = CECRequest.GetFormString("_action").ToLower(); if (_action == "search") { //查询 string _userName = CECRequest.GetFormString("txtUserName"); if (!string.IsNullOrEmpty(_userName)) { ViewBag.SearchList = MemberService.SearchAdmin(_userName); } } if (_action == "add") { int _userId = CECRequest.GetFormInt("_userId", 0); bool isSuccess = MemberService.AddAdmin(_userId); if (isSuccess) { ViewBag.Status = "AddSuccess"; } else { ViewBag.Status = "AddError"; } } //判断是否为删除 if (_action == "delete") { int _userId = CECRequest.GetFormInt("_userId", 0); MemberService.DeleteAdmin(_userId); ViewBag.Status = "DeleteSuccess"; } } var list = MemberService.AdminList(); ViewBag.List = list; return(View()); }
public ActionResult ResumeList() { if (Request.HttpMethod.ToUpper() == "POST") { if (CECRequest.GetFormString("_action").ToLower() == "del") { int id = CECRequest.GetFormInt("_id", 0); ResumeService.Delete(id); } } var list = ResumeService.List(new SearchSetting() { PageIndex = CECRequest.GetQueryInt("page", 1) }); ViewBag.List = list; return(View()); }
public ActionResult ReplyThread(FormCollection fc) { int forumId = CECRequest.GetFormInt("catalogId", 0); int topicId = CECRequest.GetFormInt("threadId", 0); var forumInfo = ForumService.Get(forumId); //检查用户是否查看的权限 //获取通过审核的用户,只有审核通过的用户才能查看论坛 var userInfo = UserService.Get(User.Identity.Name); if (!CheckApplyUserAuth(userInfo.Id, forumInfo.GroupId)) { return(new TipView() { Msg = ErrorMsg.APPLYNOTPASS }); } //判断主题是否存在 var topicInfo = ForumTopicService.Get(topicId); string threadUrlFormat = "/thread/{0}.html{1}"; if (topicInfo.Id == 0 || topicInfo.ForumId != forumId || topicInfo.IsDeleted) { return(new TipView() { Msg = ErrorMsg.THREADNOTEXISTS }); } #region == 发表回帖 == //判断提交类型 if (CECRequest.GetFormString("event_submit_do_publish") == "anything") { string replyContent = fc["txtReplyContent"]; //判断回复内容是否为空 if (string.IsNullOrEmpty(replyContent)) { return(new TipView() { Msg = "请输入回复内容", Url = String.Format(threadUrlFormat, topicInfo.Id, string.Empty) }); } //回复 ForumReplyInfo replyInfo = new ForumReplyInfo(); replyInfo.Content = replyContent; replyInfo.ForumId = topicInfo.ForumId; replyInfo.TopicId = topicInfo.Id; replyInfo.Poster = userInfo.UserName; replyInfo.PosterId = userInfo.Id; replyInfo = ForumTopicService.PostReply(topicInfo, replyInfo); return(new TipView() { Msg = ErrorMsg.POSTREPLYSUCCESS, Url = String.Format(threadUrlFormat, topicInfo.Id, String.Format("#reply{0}", replyInfo.Id)), Success = true }); } #endregion #region == 删除回帖 == if (CECRequest.GetFormString("event_submit_do_delete") == "anything") { int replyId = CECRequest.GetFormInt("replyId", 0); var replyInfo = ForumTopicService.GetReplyInfo(replyId); if (replyInfo.Id == 0 || replyInfo.IsDeleted || topicInfo.Id != replyInfo.TopicId || replyInfo.ForumId != forumId) { return(new TipView() { Msg = ErrorMsg.NOTNORMALOPERATE, Url = String.Format(threadUrlFormat, topicInfo.Id, string.Empty) }); } ForumTopicService.DeleteReply(replyInfo); return(new TipView() { Msg = ErrorMsg.DELETEREPLYSUCCESS, Url = String.Format(threadUrlFormat, topicInfo.Id, string.Empty), Success = true }); } #endregion return(new TipView() { Msg = ErrorMsg.NOTNORMALOPERATE, Url = String.Format(threadUrlFormat, topicInfo.Id, string.Empty) }); }
public ActionResult PulishThread(ForumTopicInfo oldModel) { #region == 发表主题 == if (CECRequest.GetFormString("event_submit_do_publish") == "anything") { //发布或编辑 var forumInfo = ForumService.Get(oldModel.ForumId); //检查用户是否查看的权限 //获取通过审核的用户,只有审核通过的用户才能查看论坛 var userInfo = UserService.Get(User.Identity.Name); if (!CheckApplyUserAuth(userInfo.Id, forumInfo.GroupId)) { return(new TipView() { Msg = ErrorMsg.APPLYNOTPASS }); } ViewBag.ForumInfo = forumInfo; //在这里多设一个 //下面更新问oldModel就会自动变成新的实体 int requestTopicId = oldModel.Id; oldModel.PosterId = userInfo.Id; oldModel.Poster = userInfo.UserName; if (string.IsNullOrEmpty(oldModel.Title)) { ModelState.AddModelError("Title", "帖子标题不能为空!"); } if (string.IsNullOrEmpty(oldModel.Content)) { ModelState.AddModelError("Content", "帖子内容不能为空!"); } if (ModelState.IsValid) { oldModel = ForumTopicService.PostTopic(oldModel); string url = String.Format("/thread/{0}.html", oldModel.Id); return(new TipView() { Msg = string.Format("{0}成功!", requestTopicId > 0 ? "编辑" : "发表"), Url = url, Success = true }); } } #endregion #region == 删除主题 == if (CECRequest.GetFormString("event_submit_do_delete") == "anything") { //删除主题 int forumId = CECRequest.GetFormInt("catalogId", 0); int topicId = CECRequest.GetFormInt("threadId", 0); string returnUrl = string.Format("/catalog/{0}.html", forumId); var forumInfo = ForumService.Get(forumId); //检查用户是否查看的权限 //获取通过审核的用户,只有审核通过的用户才能查看论坛 var userInfo = UserService.Get(User.Identity.Name); if (!CheckApplyUserAuth(userInfo.Id, forumInfo.GroupId)) { return(new TipView() { Msg = ErrorMsg.APPLYNOTPASS }); } var topicInfo = ForumTopicService.Get(topicId); if (topicInfo.Id > 0 && topicInfo.ForumId == forumId && !topicInfo.IsDeleted) { //执行删除操作 ForumTopicService.DeleteTopic(topicInfo); return(new TipView() { Msg = ErrorMsg.DELETETHREADSUCCESS, Success = true, Url = returnUrl }); } return(new TipView() { Msg = ErrorMsg.NOTNORMALOPERATE, Url = returnUrl }); } #endregion return(View(oldModel)); }