public ActionResult CourseInfo(string name, int pageNumber = 1) { var pageSize = 10; var courseModel = this.courseRepository.GetCourseByName(name); var users = this.userRepository.GetStudentsUsersList(); var lessons = this.courseRepository.GetLessonListForPage(pageNumber, pageSize, courseModel.Name); var pageInfo = new PageInfo() { ActionName = "CourseInfo", ControllerName = "Moder", PageNumber = pageNumber, PageSize = pageSize, TotalItems = courseModel.Lessons.Count }; ViewBag.CourseName = courseModel.Name; var courseInfoViewModel = new CourseInfoViewModel() { Users = users, CourseModel = courseModel, PageInfo = pageInfo, Lessons = lessons }; return(this.View("CourseInfo", courseInfoViewModel)); }
public CourseInfo() { InitializeComponent(); _AddList = new List <CourseMsg>(); _RemoveList = new List <CourseMsg>(); _ViewModel = new CourseInfoViewModel(); }
public IActionResult StartCourse(long idCourse) { CourseInfoViewModel civm = new CourseInfoViewModel(); civm.Course = dbContext.Course.SingleOrDefault(c => c.idCourse == idCourse); civm.Areas = dbContext.Area.Where(c => c.idCourse == idCourse).ToList(); civm.PaginatedSubareas = new List <PaginatedSubarea>(); civm.Coursewares = new List <MaterialEstudo>(); int i = 1; foreach (var area in civm.Areas) { List <Subarea> subareas = dbContext.Subarea.Where(s => s.idArea == area.idArea).ToList(); foreach (var subarea in subareas) { PaginatedSubarea pagSubarea = new PaginatedSubarea { idSubarea = subarea.idSubarea, idArea = subarea.idArea, NomeSubarea = subarea.NomeSubarea, Page = i++ }; civm.PaginatedSubareas.Add(pagSubarea); List <MaterialEstudo> materiais = dbContext.MaterialEstudo.Where(m => m.idSubarea == subarea.idSubarea).ToList(); foreach (var material in materiais) { if (material != null) { civm.Coursewares.Add(material); } } } } return(View(civm)); }
private CourseInfoViewModel GetCourseInfoViewModel(long idCourse) { CourseInfoViewModel civm = new CourseInfoViewModel(); civm.Course = dbContext.Course.SingleOrDefault(c => c.idCourse == idCourse); civm.Areas = dbContext.Area.Where(a => a.idCourse == idCourse).ToList(); return(civm); }
public ActionResult AddCourse() { CourseInfoViewModel vm = new CourseInfoViewModel(); vm.CourseId = 0; vm.IsEdit = false; vm.CourseInfo = new Course(); vm.Analytics = null; return(View("AddCourse")); }
public async Task <IActionResult> TaskInfo(int task) { using (DbContext db = new DbContext(new DbContextOptions <DbContext>())) { CourseInfoViewModel model = new CourseInfoViewModel(); List <Tracking> TrackingsList = await db.Trackings.Where(t => t.Problem.Id == task) .Include(t => t.Problem) .ThenInclude(p => p.Course) .Include(t => t.Status) .Include(t => t.User) .OrderByDescending(t => t.Time) .Select(t => t) .ToListAsync(); return(View(TrackingsList)); } }
public ActionResult GetCourseToUpdate(int idCourse, string StatusMessage = "") { CourseInfoViewModel civm = GetCourseInfoViewModel(idCourse); if (civm != null) { if (civm.Course.Image != null) { var base64 = Convert.ToBase64String(civm.Course.Image); civm.imgSrc = String.Format("data:image/jpg;base64,{0}", base64); } civm.StatusMessage = StatusMessage; return(View("Editar", civm)); } else { return(View("Error")); } }
public async Task <IActionResult> CourseInfo(int block, int course) { using (DbContext db = new DbContext(new DbContextOptions <DbContext>())) { CourseInfoViewModel model = new CourseInfoViewModel(); IEnumerable <int> latestTracking; if (block == 0 && course == 0) //страница по умолчанию { latestTracking = db.Trackings.GroupBy(t => t.Problem.Id) .Select(t => t.Max(t => t.Id)); model.Title = $"Задания всех блоков"; } else if (course == 0) //выбран блок { latestTracking = db.Trackings.Where(t => t.Problem.Course.CourseBlocks .Any(cb => cb.BlockId == block)) .GroupBy(t => t.Problem.Id) .Select(t => t.Max(t => t.Id)); model.Title = $"Задания блока { db.Blocks.Where(b => b.Id == block).FirstOrDefault().Name }"; } else //выбран курс { latestTracking = db.Trackings.Where(t => t.Problem.Course.Id == course) .GroupBy(t => t.Problem.Id) .Select(t => t.Max(t => t.Id)); model.Title = $"Задания дисциплины { db.Courses.Where(c => c.Id == course).FirstOrDefault().FullName }"; } model.Trackings = await db.Trackings.Where(t => latestTracking.Contains(t.Id)) .Include(t => t.Problem) .ThenInclude(p => p.Course) .Include(t => t.Status) .Include(t => t.User) .OrderBy(t => t.Problem.Course.Id) .ThenBy(t => t.Problem.Name) .Select(t => t) .ToListAsync(); return(View(model)); } }
public IActionResult CourseInfo(long idCourse) { CourseInfoViewModel civm = new CourseInfoViewModel(); civm.Course = dbContext.Course.SingleOrDefault(c => c.idCourse == idCourse); civm.Areas = dbContext.Area.Where(c => c.idCourse == idCourse).ToList(); civm.Subareas = new List <Subarea>(); foreach (var area in civm.Areas) { List <Subarea> subareas = dbContext.Subarea.Where(s => s.idArea == area.idArea).ToList(); foreach (var subarea in subareas) { civm.Subareas.Add(subarea); } } if (civm.Course.Image != null) { var base64 = Convert.ToBase64String(civm.Course.Image); civm.imgSrc = String.Format("data:image/jpg;base64,{0}", base64); } return(View(civm)); }
public ActionResult EditCourse(CourseInfoViewModel infoCourse) { if (ModelState.IsValid) { var database = new CourseRepository(); var course = new Course() { CourseDescription = infoCourse.CourseInfo.CourseDescription, Department = infoCourse.CourseInfo.Department, Name = infoCourse.CourseInfo.Name, GradeLevel = infoCourse.CourseInfo.GradeLevel, IsArchived = infoCourse.CourseInfo.IsArchived, StartDate = infoCourse.CourseInfo.StartDate, EndDate = infoCourse.CourseInfo.EndDate, CourseId = infoCourse.CourseInfo.CourseId, TeacherId = infoCourse.CourseInfo.TeacherId }; database.Update(course); return(RedirectToAction("Index", new { id = infoCourse.CourseInfo.CourseId })); } return(View("CourseInfo", infoCourse)); }
public async Task <IActionResult> FeesPost(string providerCode, string accreditingProviderCode, string courseCode, CourseFeesEnrichmentViewModel viewModel) { if (!ModelState.IsValid) { var routeData = GetCourseRouteDataViewModel(providerCode, courseCode); var courseDetails = await _manageApi.GetCourse(providerCode, courseCode); var courseInfo = new CourseInfoViewModel { ProgrammeCode = courseDetails.CourseCode, Name = courseDetails.Name }; viewModel.RouteData = routeData; viewModel.CourseInfo = courseInfo; await LoadCopyableCoursesIntoViewBag(providerCode, courseCode); return(View("Fees", viewModel)); } if (await SaveEnrichment(providerCode, courseCode, viewModel)) { CourseSavedMessage(); } return(RedirectToAction("Show", new { providerCode = providerCode, accreditingProviderCode = accreditingProviderCode, courseCode })); }
public ActionResult Course(int id) { CourseRepository cRepo = new CourseRepository(); CourseInfoViewModel vm = new CourseInfoViewModel(); vm.CourseId = id; vm.CourseInfo = cRepo.GetById(id); vm.IsEdit = true; //vm.Analytics = new CourseAnalytics(); var getGrades = cRepo.GetGradeBookGrades(id); var grades = new Dictionary <string, int> { { "A", 0 }, { "B", 0 }, { "C", 0 }, { "D", 0 }, { "F", 0 } }; foreach (var grade in getGrades) { var gradeLetter = Grading.Grade(grade.TotalEarned, grade.TotalPossible); grades[gradeLetter] += 1; } vm.GetGrades = grades; vm.SudentCount = getGrades.Count; if (vm.CourseInfo == null) { return(RedirectToAction("Index")); } return(View("CourseInfo", vm)); }