public IActionResult Edit(Student student)
 {
     if (ModelState.IsValid)
     {
         schoolDbContext.Update <Student>(student);
         schoolDbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserName,UserType,Password")] tblLogin tblLogin)
        {
            if (id != tblLogin.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblLogin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tblLoginExists(tblLogin.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblLogin));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("GradeId,Value,Note,Date,SubjectId,TeacherId,StudentId")] Grades grades)
        {
            if (id != grades.GradeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grades);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GradesExists(grades.GradeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentId"] = new SelectList(_context.Students, "StudentId", "StudentId", grades.StudentId);
            ViewData["SubjectId"] = new SelectList(_context.Subjects, "SubjectId", "Name", grades.SubjectId);
            ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherId", grades.TeacherId);
            return(View(grades));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Voornaam,Achternaam,Adres,Woonplaats")] Student student)
        {
            if (id != student.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
        public async Task <IActionResult> Edit(int id, [Bind("EnrollmentId,StudentId,CourseId,Grade")] Enrollment enrollment)
        {
            if (id != enrollment.EnrollmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try {
                    _context.Update(enrollment);
                    await _context.SaveChangesAsync();
                } catch (DbUpdateConcurrencyException) {
                    if (!EnrollmentExists(enrollment.EnrollmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(enrollment));
        }
Exemple #6
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CourseCode,Technology,Price")] Course course)
        {
            if (id != course.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Exemple #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,RealName,HireDate")] Instructor instructor)
        {
            if (id != instructor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(instructor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InstructorExists(instructor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(instructor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AdminId,Name,ExamDate,MarksSubmitDate,ResultPublishDate")] tblAdmin tblAdmin)
        {
            if (id != tblAdmin.AdminId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblAdmin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tblAdminExists(tblAdmin.AdminId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblAdmin));
        }
Exemple #9
0
        public async Task <IActionResult> Edit(int id, [Bind("ClassId,Name,TeacherId")] Classes classes)
        {
            if (id != classes.ClassId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(classes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClassesExists(classes.ClassId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherId", classes.TeacherId);
            return(View(classes));
        }
Exemple #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address,PhonePrimary,PhoneAlt,Fax,Email,Logo")] School school)
        {
            if (id != school.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(school);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SchoolExists(school.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(school));
        }
Exemple #11
0
        public async Task <IActionResult> Edit(int id, [Bind("StudentId,MediumId,ClassId,RollNo,SectionId,AdmissionDate,Name,Password,ConfirmPassword,FathersName,MothersName,DateOfBirth,GenderId,Address,Nationality,BloodGroupId,ReligionId,ParentsCell")] tblStudent tblStudent)
        {
            if (id != tblStudent.StudentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblStudent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tblStudentExists(tblStudent.StudentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BloodGroupId"] = new SelectList(_context.tblBloodGroup, "BloodGroupId", "BloodGroupId", tblStudent.BloodGroupId);
            ViewData["ClassId"]      = new SelectList(_context.tblClass, "ClassId", "ClassId", tblStudent.ClassId);
            ViewData["GenderId"]     = new SelectList(_context.tblGender, "GenderId", "GenderId", tblStudent.GenderId);
            ViewData["MediumId"]     = new SelectList(_context.tblMedium, "MediumId", "MediumId", tblStudent.MediumId);
            ViewData["ReligionId"]   = new SelectList(_context.tblReligion, "ReligionId", "ReligionId", tblStudent.ReligionId);
            ViewData["SectionId"]    = new SelectList(_context.tblSection, "SectionId", "SectionId", tblStudent.SectionId);
            return(View(tblStudent));
        }
Exemple #12
0
        public async Task <IActionResult> Edit(int id, [Bind("Student_Id,Name,address,PhoneNum,Avatar_Path")] Student student)
        {
            if (id != student.Student_Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.Student_Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Exemple #13
0
        public async Task <IActionResult> Edit(int id, [Bind("TeacherId,Name,ClassId,SectionId,StudentId,ExamId,Bangla,English,Math,Religion,SocialScience,Science,TotalMarks")] tblTeacher tblTeacher)
        {
            if (id != tblTeacher.TeacherId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblTeacher);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tblTeacherExists(tblTeacher.TeacherId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassId"]   = new SelectList(_context.tblClass, "ClassId", "Name", tblTeacher.ClassId);
            ViewData["ExamId"]    = new SelectList(_context.tblExam, "ExamId", "Name", tblTeacher.ExamId);
            ViewData["SectionId"] = new SelectList(_context.tblSection, "SectionId", "Name", tblTeacher.SectionId);
            ViewData["StudentId"] = new SelectList(_context.tblStudent, "StudentId", "Address", tblTeacher.StudentId);
            return(View(tblTeacher));
        }
Exemple #14
0
        public async Task <IActionResult> Edit(int id, [Bind("ParentId,PersonalDataId")] Parents parents)
        {
            if (id != parents.ParentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(parents);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ParentsExists(parents.ParentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonalDataId"] = new SelectList(_context.PersonalDatas, "PersonalDataId", "FirstName", parents.PersonalDataId);
            return(View(parents));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ExamId,Name")] tblExam tblExam)
        {
            if (id != tblExam.ExamId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tblExam);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tblExamExists(tblExam.ExamId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblExam));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,CursusId,CursistId,punten")] Inschrijving inschrijving)
        {
            if (id != inschrijving.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inschrijving);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InschrijvingExists(inschrijving.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CursistId"] = new SelectList(_context.Cursisten, "Id", "Achternaam", inschrijving.CursistId);
            ViewData["CursusId"]  = new SelectList(_context.Cursussen, "Id", "Naam", inschrijving.CursusId);
            return(View(inschrijving));
        }
Exemple #17
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,StudentId,CourseId,Grade,Passed")] Transcripts transcripts)
        {
            if (id != transcripts.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(transcripts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TranscriptsExists(transcripts.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"]  = new SelectList(_context.Courses, "ID", "ID", transcripts.CourseId);
            ViewData["StudentId"] = new SelectList(_context.Students, "ID", "FirstName", transcripts.StudentId);
            return(View(transcripts));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CourseId,Title,Credits,Grade,DepartmentId")] Course course)
        {
            if (id != course.CourseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.CourseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Id", course.DepartmentId);
            PopulateDepartmentDropDownList();
            return(View(course));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstMidName,EnrollmentDate")] Student student)
        {
            if (id != student.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Naam")] Cursus cursus)
        {
            if (id != cursus.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cursus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CursusExists(cursus.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cursus));
        }
Exemple #21
0
        public async Task <IActionResult> Edit(int id, [Bind("CourseID,StudentID")] Enrollments enrollments)
        {
            if (id != enrollments.CourseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enrollments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnrollmentsExists(enrollments.CourseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseID"]  = new SelectList(_context.Courses, "ID", "ID", enrollments.CourseID);
            ViewData["StudentID"] = new SelectList(_context.Students, "ID", "ID", enrollments.StudentID);
            return(View(enrollments));
        }
Exemple #22
0
 public IActionResult Edit()
 {
     if (!ModelState.IsValid)
     {
         return(View(ModelStd));
     }
     _db.Update(ModelStd.Student);
     _db.SaveChanges();
     return(RedirectToAction(nameof(Index)));
 }
 public IActionResult Edit(Classe s)
 {
     if (ModelState.IsValid)
     {
         _db.Update(s);
         _db.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(s));
 }
Exemple #24
0
        public int UpdateProgram(UpdateProgram model)
        {
            var program = GetProgram(model.ProgramId);

            if (program == null)
            {
                return(-1);
            }
            program.ProgramName = model.ProgramName;
            context.Update(program);
            return(context.SaveChanges());
        }
 public string UpdateStudent(Student student)
 {
     if (student.StudentId == 0)
     {
         schoolDbContext.Add <Student>(student);
     }
     else
     {
         schoolDbContext.Update <Student>(student);
     }
     schoolDbContext.SaveChanges();
     return("Operation Successful!");
 }
Exemple #26
0
        public async Task <IActionResult> EditUserGrade(string id, [Bind("Id,Mark,Subject")] Grade grade)
        {
            if (id != grade.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grade);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GradeExists(grade.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var users = _userManager.Users;
                List <UserWithRoleViewModel> model = new List <UserWithRoleViewModel>();
                foreach (ApplicationUser user in users)
                {
                    UserWithRoleViewModel mod = new UserWithRoleViewModel();
                    mod.Roles = await _userManager.GetRolesAsync(user);

                    mod.User = user;
                    model.Add(mod);
                }
                return(View("~/Views/Administration/ListUsers.cshtml", model));
            }
            return(View(grade));
        }
        public int UpdateSubject(UpdateSubject model)
        {
            var subject = GetSubject(model.SubjectId);

            if (subject == null)
            {
                return(-1);
            }
            subject.SubjectName = model.SubjectName;
            subject.MajorId     = model.MajorId;

            context.Update(subject);
            return(context.SaveChanges());
        }
        public async Task <IActionResult> EditPost(int id, [Bind("Id,RealName,HireDate,OfficeAssignment")] Instructor instructor)
        {
            if (id != instructor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(instructor);
                    if (!_context.OfficeAssignments.Select(a => a.InstructorId).Contains(instructor.Id))
                    {
                        _context.OfficeAssignments.Add(instructor.OfficeAssignment);
                    }
                    else
                    {
                        _context.Update(instructor.OfficeAssignment);
                    }
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InstructorExists(instructor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(instructor));
        }
        public int UpdateClass(UpdateClass model)
        {
            var classes = GetClass(model.ClassId);

            if (classes == null)
            {
                return(-1);
            }
            classes.ClassName = model.ClassName;
            classes.MajorId   = model.MajorId;
            classes.CourseId  = model.CourseId;
            classes.SubjectId = model.SubjectId;

            context.Update(classes);
            return(context.SaveChanges());
        }
Exemple #30
0
        public int UpdateMajor(UpdateMajor model)
        {
            var major = GetMajor(model.MajorId);

            if (major == null)
            {
                return(-1);
            }
            major.MajorName   = model.MajorName;
            major.PhoneNumber = model.PhoneNumber;
            major.Email       = model.Email;
            major.FoundedYear = model.FoundedYear;

            context.Update(major);
            return(context.SaveChanges());
        }