public ActionResult EditSecretQuestion(SecretQuestion secretQuestionViewModel) { try { var secretQuestion = new SecretQuestion { Id = secretQuestionViewModel.Id, Question = secretQuestionViewModel.Question, Answer = secretQuestionViewModel.Answer }; ApiConsumer <SecretQuestion> .ConsumePut("SecretQuestions", secretQuestion); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(VoterViewModel voterViewModel) { try { var voter = new Voter { FirstName = voterViewModel.FirstName, Id = voterViewModel.Id, LastName = voterViewModel.LastName, Cnp = voterViewModel.Cnp }; ApiConsumer <Voter> .ConsumePut("Voters", voter); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(CandidateViewModel candidateViewModel) { try { var candidate = new Candidate { FirstName = candidateViewModel.FirstName, Id = candidateViewModel.Id, LastName = candidateViewModel.LastName, PartyName = candidateViewModel.PartyName }; ApiConsumer <Candidate> .ConsumePut("Candidates", candidate); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult AddSecretQuestion(SecretQuestionViewModel secretQuestionViewModel, int id) { try { var secretQuestion = new SecretQuestion { Question = secretQuestionViewModel.Question, Answer = secretQuestionViewModel.Answer }; var voter = ApiConsumer <Voter> .ConsumeGet("Voters", id); voter.SecretQuestions.Add(secretQuestion); var result = ApiConsumer <Voter> .ConsumePut("Voters", voter); return(RedirectToAction("Index")); } catch { return(View()); } }