public ActionResult DeleteConfirmed(int SurveyId, int CandidateId)
        {
            SurveyCandidate surveyCandidate = db.SurveyCandidate.Find(SurveyId, CandidateId);

            db.SurveyCandidate.Remove(surveyCandidate);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "SurveyId,CandidateId")] SurveyCandidate surveyCandidate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(surveyCandidate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CandidateId = new SelectList(db.Candidate, "CandidateId", "Name", surveyCandidate.CandidateId);
     ViewBag.SurveyId    = new SelectList(db.Surveys, "SurveyId", "SurveyName", surveyCandidate.SurveyId);
     return(View(surveyCandidate));
 }
        // GET: SurveyCandidates/Delete/5
        public ActionResult Delete(int SurveyId, int CandidateId)
        {
            if (SurveyId == 0 || CandidateId == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SurveyCandidate surveyCandidate = db.SurveyCandidate.Find(SurveyId, CandidateId);

            if (surveyCandidate == null)
            {
                return(HttpNotFound());
            }
            return(View(surveyCandidate));
        }
        // GET: SurveyCandidates/Edit/5
        //way to handle composite primary key
        public ActionResult Edit(int SurveyId, int CandidateId)
        {
            if (SurveyId == 0 || CandidateId == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SurveyCandidate surveyCandidate = db.SurveyCandidate.Find(SurveyId, CandidateId);

            if (surveyCandidate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CandidateId = new SelectList(db.Candidate, "CandidateId", "Name", surveyCandidate.CandidateId);
            ViewBag.SurveyId    = new SelectList(db.Surveys, "SurveyId", "SurveyName", surveyCandidate.SurveyId);
            return(View(surveyCandidate));
        }