public async Task <CommonResponce> GetLiveClassroomByRefID(string UserType, string RefID) { bool isValid = true; var oLiveClassroom = await _dbStudentClassroomRepository.GetLiveClassroomByRefID(UserType, RefID); if (oLiveClassroom == null) { isValid = false; } var tempClassfixed = oLiveClassroom.FirstOrDefault(); LiveClassroomVM tempLiveClassroom = new LiveClassroomVM() { RefId = tempClassfixed.RefId, ClassroomName = tempClassfixed.ClassroomName, ClassroomDescription = tempClassfixed.ClassroomDescription, Participants = new Participants() }; tempLiveClassroom.Participants.Teacher = new AppModel.Teacher { Name = tempClassfixed.TeacherName, UserImagePath = string.Format("~/AppFileRepo/UserAvatar/{0}.{1}", tempClassfixed.thUserId, "jpg") }; tempLiveClassroom.Participants.Students = new List <AppModel.Student>(); oLiveClassroom.ForEach(f => { tempLiveClassroom.Participants.Students.Add(new AppModel.Student { Id = f.StudentId, Name = f.StudentName, Email = f.Email, RegNo = f.RegNo, UserImagePath = string.Format("~/AppFileRepo/UserAvatar/{0}.{1}", f.stUserId, "jpg") }); }); // UsrImgPath = string.Format("~/AppFileRepo/UserAvatar/{0}.{1}", CurrentUserInfo.UserID, "jpg"); CommonResponce result = new CommonResponce { Stat = isValid, StatusMsg = (isValid ? "" : "Invalid Reference Id"), StatusObj = tempLiveClassroom }; return(result); }
public async Task <IActionResult> LiveClassroom(string RefId) { CreateBreadCrumb(new[] { new { Name = "Live Class room", ActionUrl = "#" } }); //new { Name = "Room", ActionUrl = "#" } }); BaseViewModel VModel = null; var CurrentUserInfo = GetLoginUserInfo(); if (CurrentUserInfo.UserType.ToUpper().Equals("U") || CurrentUserInfo.UserType.ToUpper().Equals("S")) { var commonResponce = await _ClassroomService.GetLiveClassroomByRefID(CurrentUserInfo.UserType, RefId); if (commonResponce.Stat) { CommonResponce Userinfo; if (CurrentUserInfo.UserType.ToUpper().Equals("U")) { Userinfo = await _StudentService.GetStudentByEmailID(CurrentUserInfo.UserEmail); } else { Userinfo = await _TeacherService.GetTeacherByEmailID(CurrentUserInfo.UserEmail); } LiveClassroomVM liveRoomUserInfo = commonResponce.StatusObj; dynamic userInfo = Userinfo.StatusObj; liveRoomUserInfo.RegNo = userInfo.RegNo; } //var StudentDashboardVM = new StudentDashboardVM(); //var todayClassesVM = new List<TodaysClassesVM>(); //var todayClassroom = commonResponce.StatusObj; //List<TodaysLiveClassroom> listTodayClassroom = new List<TodaysClassroom>(); ////var ss=todayClassroom.fir //foreach (var item in todayClassroom) //{ // listTodayClassroom.Add(item); //} //var tempClassfixed = listTodayClassroom.FirstOrDefault(); //ClassroomVM tempClassroom = new ClassroomVM() //{ // RefId = tempClassfixed.RefId, // ClassroomName = tempClassfixed.ClassroomName, // ClassroomDescription = tempClassfixed.ClassroomDescription, // Participants = new Participants() //}; //tempClassroom.Participants.Teacher = new AppModel.Teacher { Name = tempClassfixed.TeacherName }; //tempClassroom.Participants.Students = new List<AppModel.Student>(); //listTodayClassroom.ForEach(f => //{ // tempClassroom.Participants.Students.Add(new AppModel.Student { Id = f.StudentId, Name = f.StudentName, Email = f.Email }); //}); //var TempVModel = new ClassroomVM //{ // UserDashboard = new UserDashboardVM { TodaysClassList = listTodayClassVM } //}; VModel = await GetViewModel(commonResponce.StatusObj); } else { var TempVModel = await GetViewModel <LiveClassroomVM>(); VModel = TempVModel; } //VModel = await GetViewModel<ClassroomVM>(); return(View(VModel)); }