// GET: VIDEOS--------------------------------------------------------------------- public async Task <ActionResult> Videos(string language) { try { string UserName = GetUserName(); if (language == null) { language = "ru"; } UserInfo userinfo = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, userinfo.LevelId, language); ViewBag.OUK = UserProgress.OUK; ViewBag.TBB = UserProgress.TBB; ViewBag.language = language; List <Webinar_VideoL> VideoLessons = await db.Webinar_VideoL.Where(e => e.language == language).OrderByDescending(e => e.XId).ToListAsync(); return(View(VideoLessons)); } catch { } string ActionName = "Trainig-Videos"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }
public async Task <IHttpActionResult> Post() { try { string UserName = User.Identity.Name; API_UserInfo UserInfo = new API_UserInfo(); UserInfo DBUserInfo = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, DBUserInfo.LevelId, "ru"); UserInfo.Name = DBUserInfo.Fname; UserInfo.SureName = DBUserInfo.Lname; UserInfo.Image = DBUserInfo.Image; UserInfo.OUK = UserProgress.OUK; UserInfo.TBB = UserProgress.TBB; return(Json(UserInfo)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
// GET: VIDEOS--------------------------------------------------------------------- public async Task <ActionResult> Videos(int Id, string language) { try { string UserName = GetUserName(); if (language == null) { language = "ru"; } UserInfo userinfo = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, userinfo.LevelId, language); var Trainings = await db.Trainings.FindAsync(Id); if (Trainings == null || Trainings.Enable == false) { return(RedirectToAction("Noaccess", "Error")); } Training_Property Training_Property = Trainings.Training_Property.FirstOrDefault(e => e.lang == language); ViewBag.OUK = UserProgress.OUK; ViewBag.TBB = UserProgress.TBB; ViewBag.ModulName = Training_Property.Titile; ViewBag.language = language; List <Training_VideoXL> VideoXLessons = Trainings.Training_VideoXL.Where(e => e.Enable == true).OrderByDescending(e => e.XId).ToList(); List <Training_VideoL> VideoLessons = VideoXLessons.Select(e => e.Training_VideoL.FirstOrDefault()).ToList(); return(View(VideoLessons)); } catch { } string ActionName = "Trainig-Videos"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }
// GET: MODULES-------------------------------------------------------------------- public async Task <ActionResult> Modules(string language) { try { string UserName = GetUserName(); if (language == null) { language = "ru"; } UserInfo userinfo = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, userinfo.LevelId, language); // Get User Modules var Trainings = await db.Trainings.Where(e => e.Enable == true).OrderBy(e => e.XId).ToListAsync(); var trainings_properties = new List <Training_Property>(); foreach (var training in Trainings) { trainings_properties.Add(training.Training_Property.FirstOrDefault()); } ViewBag.OUK = UserProgress.OUK; ViewBag.TBB = UserProgress.TBB; ViewBag.language = language; return(View(trainings_properties)); } catch { } string ActionName = "Trainig-Modules"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }
public async Task <ActionResult> certificates(string language) { try { string UserName = GetUserName(); if (language == null) { language = "ru"; } ViewBag.language = language; UserInfo UserInfoOBJ = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, UserInfoOBJ.LevelId, language); var user_certificates = UserInfoOBJ.Users_Certificates.ToList(); ViewBag.language = language; ViewBag.OUK = UserProgress.OUK; ViewBag.TBB = UserProgress.TBB; return(View(user_certificates)); } catch { } string ActionName = "certificates"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }
// GET: VIDEOLESSON---------------------------------------------------------------- public async Task <ActionResult> Videolesson(int Id, string language) { try { string UserName = GetUserName(); if (language == null) { language = "ru"; } UserInfo userinfo = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, userinfo.LevelId, language); Training_VideoL videols = await db.Training_VideoL.FindAsync(Id); if (videols != null && videols.Training_VideoXL.Enable == true) { Training_LikeV lkv = userinfo.Training_LikeV.Where(e => e.VideoXId == videols.XId).FirstOrDefault(); if (lkv != null) { ViewBag.lkv = 1; } Training_VideoL vl = db.Training_VideoL.Where(e => e.XId < videols.XId && e.language == language).OrderByDescending(e => e.XId).FirstOrDefault(); Training_VideoL vn = db.Training_VideoL.Where(e => e.XId > videols.XId && e.language == language).FirstOrDefault(); int?vlId = null; int?vnId = null; if (vl != null) { vlId = vl.Id; } if (vn != null) { vnId = vn.Id; } ViewBag.LastVId = vlId; ViewBag.NextVId = vnId; ViewBag.OUK = UserProgress.OUK; ViewBag.TBB = UserProgress.TBB; ViewBag.language = language; return(View(videols)); } return(RedirectToAction("Noaccess", "Error")); } catch { } string ActionName = "Videolesson"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }
public async Task <ActionResult> favorites(string language) { try { string UserName = GetUserName(); if (language == null) { language = "ru"; } UserInfo UserInfoOBJ = await db.UserInfoes.FirstOrDefaultAsync(e => e.UserName == UserName); JVLO jv = await db.JVLOes.FirstOrDefaultAsync(e => e.UserName == UserName); UserProgress UserProgress = await UserGet.Progress(UserName, UserInfoOBJ.LevelId, language); var EnableVideoLs = new List <VideoL>(); foreach (var videoXL in UserProgress.EnableVideoXLs) { if (videoXL.XId <= jv.X) { EnableVideoLs.AddRange(videoXL.VideoLs); } } List <VideoL> videoizb = new List <VideoL>(); foreach (var izb in UserInfoOBJ.Isbrannis.ToList()) { VideoL vid = EnableVideoLs.Where(e => e.language == language && e.XId == izb.VideoLXId).FirstOrDefault(); if (vid == null) { vid = EnableVideoLs.Where(e => e.language == "ru" && e.XId == izb.VideoLXId).FirstOrDefault(); } if (vid != null) { videoizb.Add(vid); } } ViewBag.OUK = UserProgress.OUK; ViewBag.TBB = UserProgress.TBB; ViewBag.language = language; return(View(videoizb.ToList())); } catch { } string ActionName = "favorites"; return(RedirectToAction("ErrorLogOff", "Account", new { language = language, ActionName = ActionName })); }