public JsonResult GetCourseByOrganizationId(int organizationId) { var datalist = _courseBll.GetAll().Where(c => c.Organizationid == organizationId).ToList(); var jsonData = datalist.Select(c => new { c.Id, c.Name }); return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
public ActionResult EndExam() { if (TempData["marks"] == null || TempData["courseIdNew"] == null) { return(RedirectToAction("Index")); } ViewBag.Marks = Convert.ToDouble(TempData["marks"].ToString()); //int Oid =Convert.ToInt32(TempData["organization"].ToString()); int CId = Convert.ToInt32(TempData["courseIdNew"].ToString()); Course course = new Course(); course = _courseBll.GetAll().SingleOrDefault(x => x.Id == CId); if (course != null) { ViewBag.CourseName = course.Name; int Oid = course.Organizationid; Organization organization = new Organization(); organization = _organizationBll.GetAll().SingleOrDefault(x => x.Id == Oid); if (organization != null) { ViewBag.OrganizationName = organization.Name; } } return(View()); }
public JsonResult Create(QuestionCreateForView model) { var modelNew = Mapper.Map <Question>(model); var isSaved = _questionBll.Add(modelNew); model = new QuestionCreateForView(); if (isSaved) { ViewBag.SMsg = "Saved Successfully"; } List <Organization> olist = _organizationBll.GetAll(); ViewBag.QuestionOrganizationList = new SelectList(olist, "Id", "Name", model.OrganizationId); //If I not Write OrganizationId It also work Bcz Model Also contain OrganizationId //var courseId = course.Id; List <Course> clist = _courseBll.GetAll(); ViewBag.QuestionCourseList = new SelectList(clist, "Id", "Name", model.CourseId); List <Exam> elist = _examBll.GetAll(); ViewBag.QuestionExamList = new SelectList(elist, "Id", "Topic", model.ExamId); model.QuestionTypeSelectListItems = _questionTypeBll.GetAll().Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.QuestionTypes }); model.WriteQuestion = ""; var jsonData = "success"; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
public ActionResult CourseSInOrgnization() { var model = new CourseCreateForView(); int oId = _orgId; //int totalParticipant = 0; //int totalTrainer = 0; model.CourseList = _courseBll.GetAll().Where(c => c.Organizationid == oId).ToList(); for (int i = 0; i < model.CourseList.Count; i++) { var id = model.CourseList[i].Id; model.CourseList[i].TotalParticipant = _participantBll.GetAll().Count(c => c.CourseId == id); model.CourseList[i].TotalTrainer = _trainerBll.GetAll().Count(c => c.CourseId == id); } return(View(model)); }
private void LoadList() { try { CourseBLL courseBLL = new CourseBLL(); DataTable dt = courseBLL.GetAll(); rptrList.DataSource = dt; rptrList.DataBind(); } catch (Exception) { //throw; } }
private void GenerateCode() { try { QuaintLibraryManager lib = new QuaintLibraryManager(); this.ModelCode = CodePrefix.Course + "-" + lib.GetSixDigitNumber(1); CourseBLL courseBLL = new CourseBLL(); DataTable dt = courseBLL.GetAll(); if (dt != null) { if (dt.Rows.Count > 0) { string[] lastCode = dt.Rows[dt.Rows.Count - 1]["CourseCode"].ToString().Split('-'); int lastCodeNumber = Convert.ToInt32(lastCode[1]); this.ModelCode = CodePrefix.Course + "-" + lib.GetSixDigitNumber(lastCodeNumber + 1); } } } catch (Exception) { Alert(AlertType.Error, "Failed to load."); } }
public IActionResult GetAll() { var response = logicBll.GetAll(); return(StatusCode((int)response.Message.Status, response)); }
// GET: Course public ActionResult CourseInfo(int id) { cId = id; Course course = _courseBll.GetById(id); int orgnizationId = course.Organizationid; List <Organization> orglist = _organizationBll.GetAll(); ViewBag.OrgList = new SelectList(orglist, "Id", "Name", orgnizationId); List <Course> list = _courseBll.GetAll().Where(e => e.Organizationid == orgnizationId).ToList(); ViewBag.CourseId = new SelectList(list, "Id", "Name", cId); //ViewBag.CourseId = new SelectList(new List<Course>(), "Id", "Name"); ViewBag.Examtype = _examTypeBll.GetAll() .Select(c => new SelectListItem() { Value = c.Examtype.ToString(), Text = c.ExamtypeName }).ToList(); ViewBag.Id = new SelectList(new List <Organization>(), "Id", "Name"); // .Select(c => new SelectListItem() // { // Value = c.Id.ToString(), // Text = c.Name // }).ToList(); return(View()); }