public ActionResult CourseDelete(CourseInsurance objCourseInsurance) { var data = this._courseRepository.FindOne(x => x.CourseId == objCourseInsurance.Id); data.IsDeleted = true; this._courseRepository.Update(data); return(RedirectToAction(objCourseInsurance.PageName, "Admin")); }
public ActionResult Training(CourseInsurance objCourse) { if (objCourse.Id != 0) { //TempData["courseid"] = objCourse.Id; var Obj = TrainingSteps(objCourse); return RedirectToAction("GetContent",Obj[0]); } return View(); }
public ActionResult TakeTest(CourseInsurance objCourse) { var FormId = this._courseTest.FindOne(x => x.CourseId == objCourse.CourseId).FormId; var FormName = this._formRepository.FindOne(x => x.FormId == FormId).Name; var Answers = this._userResults.FindAll().Where(x => x.UserId == UserId); var CorrectAns = new StringBuilder(); foreach (var item in Answers) { CorrectAns.Append("$('#" + item.TestQuestion.FormPlaceHolder.DivId + "').val('" + item.TestQuestion.Answer + "');"); } TempData["List"] = CorrectAns.ToString(); return(View(FormName)); }
public ActionResult AddTaxCourse_Post(CourseInsurance objAddCourseMetaData) { if (ModelState.IsValid) { Course objCourse = new Course(); objCourse.CourseName = objAddCourseMetaData.CourseName; objCourse.CatalogId = (int)Core.CourseCatalog.Tax; objCourse.IsDeleted = false; this._courseRepository.Add(objCourse); //TempData["courseid"] = objCourse.CourseId; Core.TaxCourse objTaxCourse = new TaxCourse(); objTaxCourse.Id = objCourse.CourseId; objTaxCourse.CatalogId = (int)Core.CourseCatalog.Tax; return(RedirectToAction("AddNewSection", objTaxCourse)); } return(View("AddNewSection")); }
/// <summary> /// Gets the Data of User Innsurance Information /// </summary> /// <returns></returns> public ActionResult Insurance() { var CurrentCourseId = this._courseStatus.Find(x => x.UserId == UserId).Count != 0 ? this._courseStatus.Find(x => x.UserId == UserId).OrderByDescending(x => x.CourseStatusId).FirstOrDefault().CourseId : 0; var Insurancedata = this._courseRepository.FindAll() .Where(x => x.CatalogId == (int)Core.CourseCatalog.Insurance) // && x.UserCourseMappings.Where(y => y.UserId == base.UserId).Select(y => y.CourseId).FirstOrDefault() == x.CourseId) .Select(x => { var Insurance = new CourseInsurance { Id = x.CourseId, CourseName = x.CourseName, CatalogId=x.CatalogId.Value, Steps = x.CourseSections.Count.ToString(), IsCompleted = x.CourseStatus.Where(f => f.CourseId == x.CourseId && f.UserId == base.UserId).Select(f => f.IsCompleted).Any(), CurrentCourse = x.CourseId == CurrentCourseId ? true : false }; return Insurance; }); ViewBag.Active = "liInsurance"; #region Different Method of Lambda Expression Code //var data= this._userCourseMapRepository.FindAll() // .Where(x=>x.UserId==base.UserId && // x.Course.CatalogId == 1 // ).Select(x => // { // var Insurance = new CourseInsurance // { // Id = x.CourseId.Value, // CourseName = x.Course.CourseName, // Steps = x.Course.CourseSections.Count.ToString(), // IsCompleted = (x.Course.CourseStatus.Where(y=>y.UserId==base.UserId && y.CourseId==x.CourseId).Count()) == 0 ? false : // x.Course.CourseStatus.Where(y => y.UserId == base.UserId && y.CourseId == x.CourseId).Select(y=>y.IsCompleted).Any() // }; // return Insurance; // }); #endregion return View(Insurancedata.ToList()); }
public ActionResult TaxCourse() { var tax = this._courseRepository.FindAll() .Where(x => x.CatalogId == (int)Core.CourseCatalog.Tax && x.IsDeleted == false) .Select(x => { var Taxdata = new CourseInsurance { Id = x.CourseId, CourseName = x.CourseName, CatalogId = x.CatalogId.Value, Steps = x.CourseSections.Count.ToString(), Users = x.UserCourseMappings.Count, }; return(Taxdata); }); ViewBag.Active = "liTaxCourse"; return(View(tax.ToList())); }
/// <summary> /// Gets the Section Names on Expanding /// </summary> /// <param name="data"></param> /// <returns></returns> public JsonResult GetSections(string data) { var Id = Convert.ToInt32(data); var sections = this._coursesection.Find(x => x.CourseId == Id) .Select(x => { var obj = new CourseInsurance() { Id = x.CourseId.Value, SectionTitle = x.CourseSectionName, SectionID = x.CourseSectionId, CourseName = x.Course.CourseName, CatalogId = x.Course.CatalogId.Value, IsCompleted = x.CourseStatus.Where(y => y.CourseSectionId == x.CourseSectionId && y.UserId == UserId).Any(), SectionType = x.CourseSectionContents.Where(y => y.CourseSectionID == x.CourseSectionId).Select(y => y.CourseContentTypeId).FirstOrDefault().Value }; return obj; }); return Json(sections); }
/// <summary> /// Course Results of the TaxCourse /// </summary> /// <returns></returns> public ActionResult CourseResults(CourseInsurance objSearch) { var Resultdata = this._testResultRepository.FindAll() .Where(x => x.Course.CatalogId == (int)Core.CourseCatalog.Tax && objSearch.CourseName != null ? x.User.UserCredentials.Where(y => y.UserId == x.UserId).Select(y => y.Username).FirstOrDefault().Contains(objSearch.CourseName) : true && objSearch.TestDate != new DateTime() ? x.CreatedDate == objSearch.TestDate : true ).Select(x => { var Tax = new CourseInsurance { Id = x.TestResultId, CourseName = x.User.FirstName + " " + x.User.LastName, TestDate = x.CreatedDate.Value, Score = x.TotalScore.Value.ToString() }; return(Tax); }); ViewBag.Active = "liTaxCourse"; return(View(Resultdata.ToList())); }
/// <summary> /// Course Results of the TaxCourse /// </summary> /// <returns></returns> public ActionResult UserResults(CourseInsurance objSearch) { var Resultdata = this._testResultRepository.FindAll() .Where(x => x.Course.CatalogId == (int)Core.CourseCatalog.Tax && objSearch.CourseName != null ? x.Course.CourseName.Contains(objSearch.CourseName) : true && objSearch.TestDate != new DateTime() ? x.CreatedDate == objSearch.TestDate : true ).Select(x => { var Tax = new CourseInsurance { Id = x.CourseId.Value, CourseName = x.Course.CourseName, TestDate = x.CreatedDate.Value, Score = x.TotalScore.Value.ToString() }; return(Tax); }); ViewBag.Active = "liUsers"; return(View(Resultdata.ToList())); }
/// <summary> /// Gets the Results of the Users /// </summary> /// <returns></returns> public ActionResult Results() { var Resultdata = this._testResultRepository.FindAll() .Where(x => x.UserId == base.UserId && x.Course.CatalogId == (int)Core.CourseCatalog.Tax ).Select(x => { var Insurance = new CourseInsurance { Id = x.TestResultId, CourseName = x.CourseTest.Form.Name, TestDate = x.CreatedDate.Value, Score = x.TotalScore.Value.ToString() }; return Insurance; }); ViewBag.Active = "liResults"; return View(Resultdata.ToList()); }
/// <summary> /// Gets the View of Tax Courses of the User /// </summary> public ActionResult TaxCourses() { var CurrentCourseId = this._courseStatus.Find(x => x.UserId == UserId).Count !=0? this._courseStatus.Find(x => x.UserId == UserId).OrderByDescending(x => x.CourseStatusId).FirstOrDefault().CourseId : 0 ; var Taxdata = this._courseRepository.FindAll() .Where(x => x.CatalogId == (int)Core.CourseCatalog.Tax) //&& x.UserCourseMappings.Where(y => y.UserId == base.UserId).Select(y => y.CourseId).FirstOrDefault() == x.CourseId) .Select(x => { var Tax = new CourseInsurance { Id = x.CourseId, CourseName = x.CourseName, Tests = x.CourseTests.Count, CatalogId = x.CatalogId.Value, Score = x.TestResults.Where(z => z.UserId == base.UserId && z.CourseId == x.CourseId).Select(z => z.TotalScore.Value).FirstOrDefault().ToString(), IsCompleted = x.CourseSections.Where(z => z.CourseId == x.CourseId).Select(z => z.CourseSectionId).Count() == x.CourseStatus.Where(z => z.UserId == base.UserId && z.CourseId == x.CourseId).Select(z => z.CourseSectionId).Count() ? true : false, CurrentCourse= x.CourseId == CurrentCourseId ? true: false }; return Tax; }); var TotalTests = Taxdata.Sum(x => x.Tests); var completedTests = Taxdata.Where(w => w.IsCompleted == true).Sum(s => s.Tests); int d=0; if (TotalTests!=0) { d = Convert.ToInt32(((double)completedTests / (double)TotalTests) * 100); } ViewBag.GraphPercent = d; ViewBag.Active = "liTaxCourse"; return View(Taxdata.ToList()); }