Exemplo n.º 1
0
        public JsonResult Election(ElectionViewModel electionViewModel)
        {
            var election = electionViewModel.Election;
            election.Description = "Test Descirption";
            election.CurrentStatus = Status.Scheduled;
            election.StartDate = DateTime.Now;
            election.EndDate = DateTime.Now.AddDays(10);

            _electionService.SaveElection(election);

            return Json(new {msg = "Save Successful!", error = false});
        }
Exemplo n.º 2
0
        public ActionResult Election(int? id)
        {
            if (id.HasValue)
            {
                var election = _electionService.GetElectionById(id.Value);
                var model = new ElectionViewModel {Election = election};

                return View("_ElectionForm", model);
            }
            else
            {
                var model = new ElectionViewModel();
                return View("_ElectionForm", model);
            }
        }