public ActionResult Create(FormPoll model) { Logger.Init(); try { var poll = model.ToPoll(UserName); if (!PollValidator.PollIsValid(poll, out var message)) { ModelState.AddModelError("", message); return(View(model)); } PollDbManager.Set(poll); ViewBag.Polls = PollDbManager.GetPolls(); return(Redirect("/ControlPanel")); } catch (Exception e) { Logger.Log.Error(e); return(Redirect("/ControlPanel")); } }
public void Create() { PollData poll = new PollValidator<PollData>().Validate( ctx ); if (errors.HasErrors) { run( Add ); return; } pollService.Insert( poll ); String lnkPoll = to( new wojilu.Web.Controller.Poll.PollController().Show, poll.Id ); pollService.PubCreatedFeed( poll, lnkPoll ); echoRedirect( lang( "opok" ), List ); }
public void Create() { int id = ctx.GetInt( "boardId" ); ForumBoard board = boardService.GetById( id, ctx.owner.obj ); ForumPoll poll = new PollValidator<ForumPoll>().Validate( ctx ); if (errors.HasErrors) { echoError(); return; } pollService.CreatePoll( poll, id, ctx.owner.obj, (IApp)ctx.app.obj ); echoRedirect( lang( "opok" ), alink.ToAppData( board ) ); }
public virtual void Create( long sectionId ) { ContentPost post = ContentValidator.SetValue( ctx ); ContentPoll poll = new PollValidator<ContentPoll>().Validate( ctx ); if (errors.HasErrors) { echoError(); return; } pollService.CreatePoll( sectionId, poll, post, ctx.Post( "TagList" ) ); echoToParentPart( lang( "opok" ) ); HtmlHelper.SetPostToContext( ctx, post ); }
public void Create() { int id = ctx.GetInt("boardId"); ForumBoard board = boardService.GetById(id, ctx.owner.obj); ForumPoll poll = new PollValidator <ForumPoll>().Validate(ctx); if (errors.HasErrors) { echoError(); return; } pollService.CreatePoll(poll, id, ctx.owner.obj, (IApp)ctx.app.obj); echoRedirect(lang("opok"), alink.ToAppData(board)); }
public void Create(int sectionId) { ContentPost post = ContentValidator.SetValue(ctx); ContentPoll poll = new PollValidator <ContentPoll>().Validate(ctx); if (errors.HasErrors) { echoError(); return; } pollService.CreatePoll(sectionId, poll, post, ctx.Post("TagList")); echoToParentPart(lang("opok")); HtmlHelper.SetPostToContext(ctx, post); }
public virtual void Create() { PollData poll = new PollValidator <PollData>().Validate(ctx); if (errors.HasErrors) { run(Add); return; } pollService.Insert(poll); String lnkPoll = to(new wojilu.Web.Controller.Poll.PollController().Show, poll.Id); pollService.PubCreatedFeed(poll, lnkPoll); echoRedirect(lang("opok"), List); }
public void Create( int sectionId ) { ContentPoll poll = new PollValidator<ContentPoll>().Validate( ctx ); if (errors.HasErrors) { run( Add, sectionId ); return; } Result result = pollService.CreatePoll( sectionId, poll ); if (result.HasErrors) { echo( result.ErrorsHtml ); return; } ContentPost post = postService.GetById( poll.TopicId, ctx.owner.Id ); echoToParentPart( lang( "opok" ) ); }
public void Create( int id ) { ForumBoard board = boardService.GetById( id, ctx.owner.obj ); if (board == null) { echoRedirect( alang( "exBoardNotFound" ) ); return; } ForumPoll poll = new PollValidator<ForumPoll>().Validate( ctx ); if (errors.HasErrors) { run( Add, id ); return; } pollService.CreatePoll( poll, id, ctx.owner.obj, (IApp)ctx.app.obj ); new ForumCacheRemove( boardService, this ).CreateTopic( board ); echoRedirect( lang( "opok" ), alink.ToAppData( board ) ); }
public void Create(int sectionId) { ContentPoll poll = new PollValidator <ContentPoll>().Validate(ctx); if (errors.HasErrors) { run(Add, sectionId); return; } Result result = pollService.CreatePoll(sectionId, poll); if (result.HasErrors) { echo(result.ErrorsHtml); return; } ContentPost post = postService.GetById(poll.TopicId, ctx.owner.Id); echoToParentPart(lang("opok")); }
public void Create(int id) { ForumBoard board = boardService.GetById(id, ctx.owner.obj); if (board == null) { echoRedirect(alang("exBoardNotFound")); return; } ForumPoll poll = new PollValidator <ForumPoll>().Validate(ctx); if (errors.HasErrors) { run(Add, id); return; } pollService.CreatePoll(poll, id, ctx.owner.obj, (IApp)ctx.app.obj); new ForumCacheRemove(boardService, this).CreateTopic(board); echoRedirect(lang("opok"), alink.ToAppData(board)); }
public ControlPanelController(PollValidator pollValidator) { PollDbManager = new PollDbManager(); }
public PollsController(PollValidator pollValidator) { PollDbManager = new PollDbManager(); PollValidator = pollValidator; BcClient = new BcClient(); }