public ActionResult GetStudentDetails() { //Get the required data WorkCaptureModel objWorkCaptureModel = new WorkCaptureModel(); Student obj = new Student(); SchoolDBEntities obj1 = new SchoolDBEntities(); //var ls = from std in obj.Students // select std; objWorkCaptureModel.SelectNamesList = new SelectList(obj1.Students, "StudentName", "StudentID"); //return View(obj); return View(objWorkCaptureModel); }
public ViewResult Index() { //Create a new collecction of objects to be displayed var obj = new Dictionary<int, string>(); obj[1]="Hariom"; obj[2]="Kuntal"; obj[3]="Singh"; ViewBag.HasPermission = true; //ViewData["hasPermission"] = true; ViewData["CurrentTime"] = DateTime.Now.ToString(); //Populate the Model object WorkCaptureModel objWorkCaptureModel = new WorkCaptureModel(); objWorkCaptureModel.SelectNameItem = new SelectListItem(); objWorkCaptureModel.SelectNameItem.Text = "HariomText"; objWorkCaptureModel.SelectNameItem.Value = "HariomValue"; //Create the list to be populated Dictionary<string,string> objCountry = new Dictionary<string,string>(); objCountry.Add("I","India"); objCountry.Add("N","Nepal"); objCountry.Add("S","SriLanka"); //objWorkCaptureModel.SelectNamesList = new SelectList(objCountry.Values); TeamMgmtModel objTeamMgmtModel = new TeamMgmtModel(); objWorkCaptureModel.SelectNamesList = new SelectList(objTeamMgmtModel.RolesSelectList,"EmpName","EmpId"); //return View(obj); return View(objWorkCaptureModel); }