Example #1
0
        public Poll Save(Poll poll)
        {
            session.Store(poll);
            session.SaveChanges();

            return poll;
        }
Example #2
0
 public bool Delete(Poll poll)
 {
     throw new NotImplementedException();
 }
Example #3
0
        public ActionResult Create(PollViewModel model, ExtraData user)
        {
            if (ModelState.IsValid)
            {
                Poll poll = new Poll();

                poll.CreatedBy = user.Id;
                poll.PollNumber = KeyGenerator.GetUniqueKey();
                poll.CreatedDate = DateTime.Today;

                poll.HashTag = model.Poll.HashTag;
                poll.StartDate = model.Poll.StartDate;
                poll.EndDate = model.Poll.EndDate;
                poll.Description = model.Poll.Description;
                poll.IsActive = model.Poll.IsActive;

                repository.Save(poll);

                if (model.PollHasOptions)
                {
                    return RedirectToAction("Pics", new { id = poll.PollNumber });
                }
                else
                {
                    return RedirectToAction("finish", new { id = poll.PollNumber });
                }
            }

            return View(model);
        }