public async Task <ActionResult> Add(StudentModels model) { if (!ModelState.IsValid) { return(View("Error")); } try { StudnetDB studnetDB = new StudnetDB(); var student = new DAL.Student() { Id = model.StudentId, Age = model.Age, Name = model.Name }; foreach (var sub in model.Subjects.Where(s => s.Checked)) { student.Subjects.Add(studnetDB.Subjects.Where(s => s.SubjectId == sub.Id).First()); } studnetDB.Students.Add(student); await studnetDB.SaveChangesAsync(); return(RedirectToAction("Index", "Home")); } catch { return(View("Error")); } }
public ActionResult Student_Index() { if (!this.User.IsInRole("Student")) { return(RedirectToAction("Index", "Home")); } string UserId = System.Web.HttpContext.Current.User.Identity.GetUserId(); GradebookViewModel viewModel = new GradebookViewModel(); viewModel.grades = new List <GradeBookModel>(); StudentModels currentStudent = new StudentModels(); List <StudentModels> students = db.studentModels.ToList(); List <GradeBookModel> all_grades = db.gradeBookModel.ToList(); foreach (StudentModels student in students) { if (student.student_account_Id == UserId) { currentStudent = student; viewModel.studentName = student.fName + " " + student.lName; break; } } foreach (GradeBookModel grade in all_grades) { if (grade.student_Id == currentStudent.student_Id) { grade.ClassModel = db.classmodel.Find(grade.class_Id); grade.TaskModel = db.taskModel.Find(grade.task_Id); viewModel.grades.Add(grade); } } return(View(viewModel)); }
public List <StudentModels> GetStandarsLookupList(int SubjectId, int _Parma, int SchoolID) { List <StudentModels> StudentModelsList = new List <StudentModels>(); StudentModels studentModels = new StudentModels(); DataTable dtSubjectList = new DataTable(); dtSubjectList = studentModels.GetSubjectLookup(SubjectId, SchoolID); if (dtSubjectList.Rows.Count > 0) { foreach (DataRow dr in dtSubjectList.Rows) { StudentModels StudentModelsTypes = new StudentModels(); if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["SubjectId"])))) { StudentModelsTypes.SubjectId = Convert.ToInt32(dr["SubjectId"]); } if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["Exam_Id"])))) { StudentModelsTypes.ExamId = Convert.ToInt32(dr["Exam_Id"]); } if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["Subject"])))) { StudentModelsTypes.Subject = Convert.ToString(dr["Subject"]); } if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["Description"])))) { StudentModelsTypes.Description = Convert.ToString(dr["Description"]); } StudentModelsList.Add(StudentModelsTypes); } } return(StudentModelsList); }
public async System.Threading.Tasks.Task <ActionResult> CreateAsync([Bind(Include = "Id,Email,Name,Class")] StudentModels studentModels) { if (ModelState.IsValid) { db.StudentModels.Add(studentModels); db.SaveChanges(); var user = new ApplicationUser { UserName = studentModels.Email, Email = studentModels.Email }; var result = await UserManager.CreateAsync(user, "Divine123!"); if (result.Succeeded) { var InfoToAdd = new AccountInfoModels(); InfoToAdd.AccountId = user.Id; InfoToAdd.Email = user.Email; InfoToAdd.Name = studentModels.Name; InfoToAdd.Role = "Student"; await UserManager.AddToRoleAsync(user.Id, "Student"); db.AccountInfoModels.Add(InfoToAdd); db.SaveChanges(); } return(RedirectToAction("Index")); } return(View(studentModels)); }
public ActionResult viewsubjectsList() { if (!string.IsNullOrEmpty(Convert.ToString(Session["ExamID"]))) { StudentModels qModel = new StudentModels(); int SchoolID = Convert.ToInt32(Session["ExamID"]); try { List <StudentModels> listSubjectTree = new List <StudentModels>(); HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(appKey.GetapiURL()); httpClient.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); var response = httpClient.GetAsync("Student/subjectTree?SchoolID=" + SchoolID).Result; if (response.IsSuccessStatusCode) { listSubjectTree = JsonConvert.DeserializeObject <List <StudentModels> >(response.Content.ReadAsStringAsync().Result); } ViewBag.getSubjectTree = listSubjectTree; return(Json(listSubjectTree, JsonRequestBehavior.AllowGet)); //return View(); } catch (Exception ex) { string error = ex.ToString().Trim(); return(RedirectToAction("logins", "logins")); } } else { return(RedirectToAction("logins", "logins")); } }
public List <StudentModels> GetStandarsLookupList() { List <StudentModels> StudentModelsList = new List <StudentModels>(); StudentModels studentModels = new StudentModels(); DataTable dtSubjectList = new DataTable(); dtSubjectList = studentModels.GetStudentLookup(); if (dtSubjectList.Rows.Count > 0) { foreach (DataRow dr in dtSubjectList.Rows) { StudentModels StudentModelsTypes = new StudentModels(); if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["Exam_id"])))) { StudentModelsTypes.ExamId = Convert.ToInt32(dr["Exam_id"]); } if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["ExamName"])))) { StudentModelsTypes.ExamName = Convert.ToString(dr["ExamName"]); } if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["Description"])))) { StudentModelsTypes.Description = Convert.ToString(dr["Description"]); } if (!string.IsNullOrEmpty(Convert.ToString(Convert.ToString(dr["Active"])))) { StudentModelsTypes.Active = Convert.ToBoolean(dr["Active"]); } StudentModelsList.Add(StudentModelsTypes); } } return(StudentModelsList); }
public ActionResult fill_out_survey(int id) { if (!this.User.IsInRole("Student")) { return(RedirectToAction("Index", "Home")); } SurveyQAViewModel a_survey = new SurveyQAViewModel(); StudentModels current_student = new StudentModels(); List <SurveyAnswers> answer_forms = db.surveyAnswers.ToList(); string UserId = System.Web.HttpContext.Current.User.Identity.GetUserId(); bool new_form = true; List <StudentModels> students = db.studentModels.ToList(); List <SurveyQuestion> questions = db.surveyQuestion.ToList(); a_survey.SurveyModel = db.surveyModel.Find(id); a_survey.survey_Id = a_survey.SurveyModel.survey_Id; a_survey.SurveyQuestions = new List <SurveyQuestion>(); a_survey.answer_list = new List <SurveyAnswers>(); foreach (StudentModels student in students) { if (student.student_account_Id == UserId) { current_student = student; a_survey.StudentModels = db.studentModels.Find(current_student.student_Id); a_survey.student_Id = a_survey.StudentModels.student_Id; } } foreach (SurveyQuestion question in questions) { new_form = true; if (question.survey_Id == id) { a_survey.SurveyQuestions.Add(question); foreach (SurveyAnswers answer in answer_forms) { if (answer.question_Id == question.question_Id) { if (answer.student_Id == current_student.student_Id) { a_survey.answer_list.Add(answer); new_form = false; break; } } } if (new_form == true) { SurveyAnswers new_answer = new SurveyAnswers(); new_answer.answer = false; new_answer.question_Id = question.question_Id; new_answer.student_Id = current_student.student_Id; a_survey.answer_list.Add(new_answer); db.surveyAnswers.Add(new_answer); db.SaveChanges(); } } } return(View(a_survey)); }
public ActionResult List(string searchText) { List <vw_Student_Lists> students = new List <vw_Student_Lists>(); if (Session["ClientId"] != null) { if (Roles.IsUserInRole("CenterManager") && Session["BranchId"] != null) { students = StudentModels.GetStudentsList(searchText, (int)Session["ClientId"], (int)Session["BranchId"]); } else { students = StudentModels.GetStudentsList(searchText, (int)Session["ClientId"], null); } } else { if (Roles.IsUserInRole("SuperAdmin")) { students = StudentModels.GetStudentsList(searchText, null, null); } } if (Request.IsAjaxRequest()) { return(PartialView("StudentListUserControl", students)); } return(View()); }
public IHttpActionResult SaveStudent([FromBody] StudentModels studentModels) { bool Status = false; Status = studentModels.SaveStudent(); return(ResponseMessage(Request.CreateResponse(Status))); }
public ActionResult List(int?id) { if (Roles.IsUserInRole("SuperAdmin")) { if (id != null) { ViewData.Model = StudentModels.GetStudentsList((int)id, null); } else { ViewData.Model = StudentModels.GetStudentsList(); } } if (Session["ClientId"] != null) { int clientId = (int)Session["ClientId"]; if (Roles.IsUserInRole("CenterManager")) { if (Session["BranchId"] != null) { ViewData.Model = StudentModels.GetStudentsList((int)Session["BranchId"], clientId); } } else { ViewData.Model = StudentModels.GetClientStudentsList((int)clientId); } } return(View()); }
// // GET: /Admin/ManagementStudent/ public ActionResult Index() { var list = new StudentModels(); var model = list.ListAll(); return(View(model)); //return View(); }
public ActionResult NewAdmission(string searchText) { if (Request.IsAjaxRequest()) { return(PartialView("StudentListUserControl", StudentModels.GetStudentsList(searchText))); } return(View()); }
public ActionResult NewAdmission() { ViewData["Zones"] = Utilities.GetZoneNameList(); ViewData["Regions"] = Utilities.GetRegionNameList(null); ViewData["Branches"] = Utilities.GetBranchNameList(); ViewData.Model = StudentModels.GetNewAdmissionList(); return(View()); }
public ActionResult studentUpload(HttpPostedFileBase file, studentUploads newUpload) { string userID = User.Identity.GetUserId(); string className = ""; List <StudentModels> students = db.studentModels.ToList(); StudentModels this_student = new StudentModels(); foreach (StudentModels student in students) { if (student.student_account_Id == userID) { this_student = student; } } this_student.ClassModel = db.classmodel.Find(this_student.class_Id); className = this_student.ClassModel.className; if (file == null) { ViewBag.StatusMessage = "No file Selected"; return(View(newUpload)); } else { if (ModelState.IsValid) { var strs = file.FileName.Split('.'); string ext = strs[strs.Count() - 1]; if (ext == "pdf" || ext == "txt" || ext == "css" || ext == "html" || ext == "js") { if (newUpload.file_name == null) { newUpload.file_name = file.FileName; } else { newUpload.file_name += ("." + ext); } string path = Server.MapPath("~//Uploads//classData//" + className + "//" + userID + "//" + newUpload.file_name); file.SaveAs(path); newUpload.createDate = DateTime.Now; newUpload.student_id = this_student.student_Id; db.studentUpload.Add(newUpload); db.SaveChanges(); return(RedirectToAction("studentIndex")); } else { return(View(newUpload)); } } else { ViewBag.StatusMessage = "Invalid Filetype."; return(View(newUpload)); } } }
public ActionResult DeleteConfirmed(int id) { StudentModels studentModels = db.StudentModels.Find(id); AccountInfoModels accountInfoModels = db.AccountInfoModels.Where(s => s.Email == studentModels.Email).SingleOrDefault(); db.AccountInfoModels.Remove(accountInfoModels); db.StudentModels.Remove(studentModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Email,Name,Class")] StudentModels studentModels) { if (ModelState.IsValid) { db.Entry(studentModels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studentModels)); }
public IHttpActionResult Delete(int SchoolID, int stdID) { bool Status = false; StudentModels subjecttModelsList = new StudentModels(); subjecttModelsList.SchoolID = SchoolID; subjecttModelsList.ExamId = stdID; Status = subjecttModelsList.DeleteRecord(); return(ResponseMessage(Request.CreateResponse(Status))); }
public ActionResult StudentImageLoader(int id) { byte[] studentPhoto = StudentModels.GetStudentPhoto(id); if (studentPhoto != null) { return(File(studentPhoto, "image/jpg")); } return(null); }
public void welcomeMessage(StudentModels student, ApplicationUser user) { MessagingModel message = new MessagingModel(); message.subject = "Welcome to Edulytics " + student.fName + "!"; message.message = "Welcome " + student.fName + "! This is your direct message section which allows you to privately message anyone in your school with just the click of a mouse. You're in the \"" + student.ClassModel.className + "\" class which is part of the " + student.ClassModel.ProgramModels.programName + " program. Have a great start to this new program and once again welcome from all of us here at Edulytics."; message.recieving_id = user.Id; message.sending_id = this.User.Identity.GetUserId(); message.dateSent = DateTime.Now; db.messagingModel.Add(message); }
public ActionResult CreateMenu(StudentModels st) { var add = new abc.StudentDao(); add.Add(st); //var m = new Menu1 { Id = id, Text = text, price = price }; //ViewBag.Info = string.Format( // "menu created:{0}, price = {1}, category: {2}", m.Text, m.price, m.Category // ); return(View("PassingData")); }
public async Task createStudentStep2(StudentModels student, ApplicationUser user, RegisterViewModel newUser) { student.student_account_Id = user.Id; db.studentModels.Add(student); Directory.CreateDirectory(Server.MapPath("~//Uploads//classData//" + student.ClassModel.className + "//" + student.student_account_Id)); addRole(user); await studentConfirmationEmail(user.Email, newUser.Password, student.fName, student.lName, user.UserName); //Commented out while trouble shooting, uncomment to enable confirmation emails, username/password for send grid also required in function welcomeMessage(student, user); createGrades(student); //create gradebook entries retroactively for tasks already assigned to class db.SaveChanges(); }
public ActionResult Batchs(int id) { List <vw_Admissions> students = new List <vw_Admissions>(); students = StudentModels.GetNewAdmissionListByBatchId(id); if (Request.IsAjaxRequest()) { return(PartialView("NewAdmissionUserControl", students)); } ViewData["BatchOfStudents"] = students; return(View()); }
public ActionResult Create(StudentModels student) { try { studentCollection.InsertOne(student); return(RedirectToAction("Index")); } catch { return(View()); } }
public IHttpActionResult VoteStudents(int SchoolID, int stdID, int StudentID, int NominaterID) { bool Status = false; StudentModels subjecttModelsList = new StudentModels(); subjecttModelsList.SchoolID = SchoolID; subjecttModelsList.ExamId = stdID; //subjecttModelsList.StudentId = StudentID; subjecttModelsList._LOCALID = NominaterID; Status = subjecttModelsList.VoteLeader(); return(ResponseMessage(Request.CreateResponse(Status))); }
public IHttpActionResult EnableVoteSections(int SchoolID, int stdID, string IsEnable, int CreatedBy) { bool Status = false; StudentModels subjecttModelsList = new StudentModels(); subjecttModelsList.SchoolID = SchoolID; subjecttModelsList.ExamId = stdID; subjecttModelsList._LOCALID = Convert.ToInt32(IsEnable); subjecttModelsList.LoginUserID = CreatedBy; Status = subjecttModelsList.EnableVoteSection(); return(ResponseMessage(Request.CreateResponse(Status))); }
public IHttpActionResult ElimatedUser(int SchoolID, int stdID, string UserIDList, int CreatedBy) { bool Status = false; StudentModels subjecttModelsList = new StudentModels(); subjecttModelsList.SchoolID = SchoolID; subjecttModelsList.ExamId = stdID; subjecttModelsList.VoterList = UserIDList; subjecttModelsList.LoginUserID = CreatedBy; Status = subjecttModelsList.EliminateUsers(); return(ResponseMessage(Request.CreateResponse(Status))); }
public IHttpActionResult Save(int ExamID, string Name, string Desc, int UserID) { bool Status = false; StudentModels subjecttModelsList = new StudentModels(); subjecttModelsList.ExamId = ExamID; subjecttModelsList.ExamName = Name; subjecttModelsList.Description = Desc; subjecttModelsList.LoginUserID = UserID; Status = subjecttModelsList.SaveRecord(); return(ResponseMessage(Request.CreateResponse(Status))); }
public ActionResult AdmReceipt() { if (Session["CurrentAdmId"] != null) { int id = (int)Session["CurrentAdmId"]; ViewData.Model = StudentModels.GetAdmissionDetailsById(id); if (Session["BranchId"] != null) { ViewData["BranchName"] = BranchModels.GetBranchDetailsById((int)Session["BranchId"]); } } return(View()); }
public JsonResult isRegistrationNumberExits(string id) { if (Session["ClientId"] != null) { int clientId = (int)Session["ClientId"]; bool isUser = StudentModels.RegistrationExists(id, clientId); return(Json(isUser)); } else { return(Json(false)); } }
public ActionResult Student_Chart() { if (!this.User.IsInRole("Student")) { return(RedirectToAction("Index", "Home")); } string UserId = System.Web.HttpContext.Current.User.Identity.GetUserId(); List <GradeBookModel> this_grade = new List <GradeBookModel>(); //List<TaskModel> tasks = new List<TaskModel>(); FOR TASK DROPDOWN GradeBookModel a_grade = new GradeBookModel(); var students = db.studentModels.ToList(); var grades = db.gradeBookModel.ToList(); StudentModels this_student = new StudentModels(); foreach (StudentModels student in students) { if (student.student_account_Id == UserId) { this_student = student; } } foreach (GradeBookModel grade in grades) { grade.TaskModel = new TaskModel(); grade.TaskModel = db.taskModel.Find(grade.task_Id); grade.task_Id = grade.TaskModel.task_Id; int class_possible = 0; decimal?class_total = 0; if (grade.student_Id == this_student.student_Id) { //tasks.Add(grade.TaskModel); ADD TASK TO DROPDOWN foreach (GradeBookModel grade1 in grades) { if (this_student.class_Id == grade1.class_Id) { grade.possiblePoints = grade.TaskModel.points; if (grade.task_Id == grade1.task_Id) { class_possible += grade.TaskModel.points; class_total += grade1.pointsEarned; } } } grade.grade = (class_total / class_possible) * 100; a_grade = grade; this_grade.Add(a_grade); } } //ViewBag.task_id = new SelectList(tasks, "task_Id", "taskName"); SEND TASK DROPDOWN return(View(this_grade)); }