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 ActionResult Process(FormPoll pollForm) { Logger.Init(); if (pollForm.Id == Guid.Empty) { return(Redirect("/ControlPanel")); } var poll = PollDbManager.GetPollWithId(pollForm.Id.ToString()); if (poll.Author == UserName && Enum.TryParse <PollAction>(Request.QueryString["Action"], out var realAction)) { PollDbManager.ApplyPollAction(pollForm.Id.ToString(), realAction); } return(Redirect("/ControlPanel")); }