public ActionResult Search() { var model = new CourseCreateForView(); int totalParticipant = 0; int totalTrainer = 0; model.CourseList = _courseBll.GetAll(); for (int i = 0; i < model.CourseList.Count; i++) { var courseId = model.CourseList[i].Id; model.CourseList[i].TotalBatch = _batchBll.GetAll().Count(c => c.CourseId == courseId); model.CourseList[i].TotalParticipant = _participantBll.GetAll().Count(c => c.CourseId == courseId); model.CourseList[i].TotalTrainer = _trainerBll.GetAll().Count(c => c.CourseId == courseId); } model.TotalParticipant = totalParticipant; model.TotalTrainer = totalTrainer; model.OrganizationListItems = _organizationBll.GetAll(). Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList();; return(View(model)); }
//DropdownListin Batch For AssignParticipants public JsonResult AssignParticipants() { var dataList = _participantBll.GetAll().ToList(); var jsonData = dataList.Select(c => new { c.Id, c.Name }); return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
public JsonResult GetParticipantByCourseId(int courseId) { var model = new ExamEntryForView(); var datalist = _participantBll.GetAll().Where(c => c.CourseId == courseId).ToList(); var jsonData = datalist.Select(c => new { c.Id, c.Name }); 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)); }
public ActionResult ParticipantCreate(ParticipantCreateForView model, HttpPostedFileBase Img) { var participant = Mapper.Map <Participant>(model); if (ModelState.IsValid) { string fileName = Path.GetFileName(Img.FileName); string extention = Path.GetExtension(Img.FileName); fileName = fileName + DateTime.Now.ToString("yymmssfff") + extention; participant.Img = "~/Image/Participant/" + fileName; string filePath = Path.Combine(Server.MapPath("~/Image/Participant/"), fileName); Img.SaveAs(filePath); var mess = ""; //var contactNo = ""; //var email = ""; var isSave = false; var participantall = _participantBll.GetAll(); for (int i = 0; i < participantall.Count; i++) { if ((model.ContactNo == participantall[i].ContactNo) || (model.Email == participantall[i].Email)) { isSave = true; } } if (isSave == true) { ViewBag.EMsg = "Duplicate"; } else { var isAdded = _participantBll.Add(participant); if (isAdded) { ViewBag.SMsg = "Save Is Successfully"; } else { ViewBag.EMsg = "Save Is UnSuccessfully"; } } model = new ParticipantCreateForView(); model.CourSelectListItems = GetDefaultSelectListItem(); model.OrganiSelectListItems = _organizationBll.GetAll() .Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }); model.BathcSelectListItems = GetDefaultSelectListItem(); ViewBag.SmsIs = mess; } return(View(model)); }