public static string getTeacher(int idCourse) { string profesor = ""; int idprof = 0; ViaroAPPEntities db = new ViaroAPPEntities(); idprof = Int32.Parse(db.Courses.Find(idCourse).id_teacher.ToString()); profesor = db.teachers.Find(idprof).first_name.ToString(); return(profesor); }
public PartialViewResult CourseDropDownlist() { ViaroAPPEntities db = new ViaroAPPEntities(); var Courses = (from c in db.Courses join p in db.teachers on c.id_teacher equals p.id_teacher select new { name = c.name + " " + p.first_name, c.id_course }).ToList(); ViewBag.Courses = new SelectList(Courses, "id_course", "name"); return(PartialView("DropDownList", Courses)); }