public void Update(int id) { ForumLink link = linkService.GetById(id, ctx.owner.obj); if (link == null) { echoRedirect(lang("exDataNotFound")); return; } link = ForumValidator.ValidateLink(link, ctx); if (errors.HasErrors) { run(Edit, id); return; } Result result = linkService.Update(link); if (result.HasErrors) { errors.Join(result); run(Edit, id); return; } logService.Add((User)ctx.viewer.obj, ctx.app.Id, alang("logEditLink") + ":" + link.Name, ctx.Ip); redirect(List); }
public void Create() { ForumLink link = ForumValidator.ValidateLink(ctx); if (errors.HasErrors) { run(New); return; } Result result = linkService.Insert(link); if (result.HasErrors) { errors.Join(result); run(New); return; } logService.Add((User)ctx.viewer.obj, ctx.app.Id, alang("logAddLink") + ":" + link.Name, ctx.Ip); redirect(List); }