public async Task <ActionResult> Index() { var teacherModel = new List <TeacherViewModel>(); var teacherList = await _teacherService.GetTeacherListAsync(); teacherList.ForEach(t => { teacherModel.Add(new TeacherViewModel { ID = t.ID, Address = t.Address, DateOfBirth = t.DateOfBirth, Gender = t.Gender, Name_Teacher = t.Name_Teacher, Phone = t.Phone, Email = t.Email, RoleId = t.RoleId, Role = t.Role }); }); ViewBag.listTeacher = teacherModel; ViewBag.listScience = await _scienceService.GetScienseListAsync(); return(View()); }
public async Task <ActionResult> Index() { //isThemMoi = true; //ViewBag.Check = isThemMoi; //string maincnn = ConfigurationManager.ConnectionStrings["AppDbContext"].ConnectionString; //SqlConnection sqlcnn = new SqlConnection(maincnn); //string condition = "select * from Science where (1=1) order by CreatedDate desc"; //SqlDataAdapter sqlda = new SqlDataAdapter(condition, maincnn); //sqlcnn.Open(); //DataTable dt = new DataTable(); //sqlda.Fill(dt); //IEnumerable<Science> model = ConvertToTankReadings(dt); //ViewBag.listSciense = model; //sqlcnn.Close(); var scienceModel = new List <ScienceViewModel>(); var scienses = await _scienseService.GetScienseListAsync(); scienses.ForEach(sc => { scienceModel.Add(new ScienceViewModel { ID = sc.ID, Address = sc.Address, Description = sc.Description, Founding = sc.Founding, Name = sc.Name }); }); ViewBag.ScienceList = scienceModel; return(View()); }
public async Task <ActionResult> ManageTeacher() { var listScience = await _scienseService.GetScienseListAsync(); ViewBag.listScience = listScience; return(View()); }