// GET: Developers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Developers developers = db.Developers.Find(id); if (developers == null) { return(HttpNotFound()); } var checkedskill = SkillLists.GetForDeveloper(id); var allskills = SkillLists.GetAll(); var checkboxlist = new List <Skills>(); foreach (var skill in allskills) { checkboxlist.Add(new Skills() { ID = skill.ID, SkillName = skill.SkillName, //We should have already-selected genres be checked HaveSkill = checkedskill.Where(x => x.ID == skill.ID).Any() }); } developers.Skill = checkboxlist; return(View(developers)); }
// GET: Developers/Create public ActionResult Create() { Developers model = new Developers(); var allskills = SkillLists.GetAll(); var checkboxlist = new List <Skills>(); foreach (var skill in allskills) { checkboxlist.Add(new Skills() { ID = skill.ID, SkillName = skill.SkillName, HaveSkill = false }); } model.Skill = checkboxlist; return(View(model)); }