public void UpdateCategory(int id) { ForumBoard board = boardService.GetById(id, ctx.owner.obj); if (board == null) { echoRedirect(alang("exCategoryNotFound")); return; } board = ForumValidator.ValidateBoard(board, ctx); // 确保只是作为分类 board.IsCategory = 1; if (errors.HasErrors) { run(EditCategory, board.Id); return; } Result result = boardService.Update(board); if (result.HasErrors) { errors.Join(result); run(EditCategory, board.Id); return; } String logmsg = string.Format(alang("editBoardCategory") + ":{0}(id:{1})", board.Name, id); logService.Add((User)ctx.viewer.obj, ctx.app.Id, logmsg, ctx.Ip); echoRedirect(lang("opok"), Index); }
public void SaveCategory() { ForumBoard fb = ForumValidator.ValidateBoard(ctx); if (errors.HasErrors) { run(AddCategory); return; } // 确保只是作为分类 fb.IsCategory = 1; Result result = boardService.Insert(fb); if (result.HasErrors) { errors.Join(result); run(AddCategory); return; } String str = ((ForumApp)ctx.app.obj).Security; boardService.UpdateSecurity(fb, str); logService.Add((User)ctx.viewer.obj, ctx.app.Id, alang("addBoardCategory") + ":" + fb.Name, ctx.Ip); echoToParentPart(lang("opok")); }
public void UpdateBoard(int id) { ForumBoard board = boardService.GetById(id, ctx.owner.obj); if (board == null) { echoRedirect(alang("exBoardNotFound")); return; } board = ForumValidator.ValidateBoard(board, ctx); if (errors.HasErrors) { run(EditBoard, id); return; } Result result = boardService.Update(board); if (result.HasErrors) { errors.Join(result); run(EditBoard, id); return; } // 上传图片处理 if (ctx.HasUploadFiles) { HttpFile uploadFile = ctx.GetFileSingle(); if (uploadFile.ContentLength > 1) { Result uploadResult = Uploader.SaveImg(uploadFile); if (uploadResult.IsValid) { boardService.UpdateLogo(board, uploadResult.Info.ToString()); } } } String logmsg = string.Format(alang("editBoard") + ":{0}(id:{1})", board.Name, id); logService.Add((User)ctx.viewer.obj, ctx.app.Id, logmsg, ctx.Ip); echoToParentPart(lang("opok"), to(Index)); }
public void SaveBoard() { ForumBoard fb = ForumValidator.ValidateBoard(ctx); if (errors.HasErrors) { run(AddSubBoard, fb.Id); return; } Result result = boardService.Insert(fb); if (result.HasErrors) { errors.Join(result); run(AddSubBoard, fb.Id); return; } String str = ((ForumApp)ctx.app.obj).Security; boardService.UpdateSecurity(fb, str); // 上传图片处理 if (ctx.HasUploadFiles) { HttpFile uploadFile = ctx.GetFileSingle(); if (uploadFile.ContentLength > 1) { Result uploadResult = Uploader.SaveImg(uploadFile); if (uploadResult.IsValid) { boardService.UpdateLogo(fb, uploadResult.Info.ToString()); } } } logService.Add((User)ctx.viewer.obj, ctx.app.Id, alang("addBoard") + ":" + fb.Name, ctx.Ip); echoToParentPart(lang("opok")); }