Пример #1
0
        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"));
            }
        }
Пример #2
0
        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 );
        }
Пример #3
0
        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 ) );
        }
Пример #4
0
        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 );
        }
Пример #5
0
        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));
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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" ) );
        }
Пример #9
0
        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 ) );
        }
Пример #10
0
        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"));
        }
Пример #11
0
        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();
 }
Пример #13
0
 public PollsController(PollValidator pollValidator)
 {
     PollDbManager = new PollDbManager();
     PollValidator = pollValidator;
     BcClient      = new BcClient();
 }