//GET: Candidates/Details/5 public ActionResult Details(int?id) { if (!id.HasValue) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Candidate candidate = m_repo.GetCandidate(id.Value); if (candidate == null) { return(HttpNotFound()); } return(View(candidate)); }
public ActionResult DetailsModal(int id) { var year = DateTime.Now.Year; Candidate candidate = m_repo.GetCandidate(id, year); if (candidate == null) { candidate = new Candidate { GenotypeId = id, Year = year }; m_repo.SaveCandidate(candidate); } else { m_repo.DeleteCandidate(candidate); } Genotype genotype = m_repo.GetGenotype(id); if (genotype == null) { return(RedirectToAction("List")); } return(PartialView("_DetailsModal", genotype)); }