public ActionResult Edit(Models.Student userprofile)
        {
            if (ModelState.IsValid)
            {
                string username = User.Identity.Name;
                // Get the userprofile
                Models.Student user = db.Students.FirstOrDefault(u => u.StudentEmail.Equals(username));

                // Update fields
                user.StudentName = userprofile.StudentName;
                user.Level       = userprofile.Level;
                user.Mobile      = userprofile.Mobile;
                user.DateOfBirth = userprofile.DateOfBirth;

                user.StudentEmail    = userprofile.StudentEmail;
                user.Password        = userprofile.Password;
                db.Entry(user).State = EntityState.Modified;

                db.SaveChanges();

                return(RedirectToAction("Index", "Home")); // or whatever
            }

            return(View(userprofile));
        }
 public ActionResult Edit([Bind(Include = "ProjectID,ProjectName,Abstract,Professor")] Project project)
 {
     if (ModelState.IsValid)
     {
         db.Entry(project).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(project));
 }
 public ActionResult Edit([Bind(Include = "LinkID,LinkName,LinkDescription,LinkUse,Link1,LinkPhoto")] Link link)
 {
     if (ModelState.IsValid)
     {
         db.Entry(link).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(link));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "StudentID,StudentName,DateOfBirth,Level,Mobile,StudentEmail,Password,ActivationCode,Verification")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
 public ActionResult Edit([Bind(Include = "StudentID,SectionNumber,Semester,Year")] Transcript transcript)
 {
     if (ModelState.IsValid)
     {
         db.Entry(transcript).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(transcript));
 }
 public ActionResult Edit([Bind(Include = "DepartmentCode,DepartmentName")] Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(department));
 }
Пример #7
0
 public ActionResult Edit([Bind(Include = "InstructorID,InstructorName")] Instructor instructor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(instructor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(instructor));
 }
 public ActionResult Edit([Bind(Include = "RequestId,CourseName,Type,Description")] Request request)
 {
     if (ModelState.IsValid)
     {
         db.Entry(request).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(request));
 }
Пример #9
0
 public ActionResult Edit([Bind(Include = "TypeID,TypeName")] Models.Type type)
 {
     if (ModelState.IsValid)
     {
         db.Entry(type).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(type));
 }
Пример #10
0
 public ActionResult Edit([Bind(Include = "DepartmentCode,CourseCode,CourseTitle,CrediteHour,Syllabus")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentName", course.DepartmentCode);
     return(View(course));
 }
Пример #11
0
 public ActionResult Edit([Bind(Include = "MaterialNumber,DepartmentCode,CourseCode,SectionNumber,Semester,Year,LectureNumber,LectureName,PDF")] Material material)
 {
     if (ModelState.IsValid)
     {
         db.Entry(material).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Sections, "DepartmentCode", "DepartmentCode", material.DepartmentCode);
     return(View(material));
 }
Пример #12
0
 public ActionResult Edit([Bind(Include = "RoleNumber,Role1,StudentID,RoleDescription")] Role role)
 {
     if (ModelState.IsValid)
     {
         db.Entry(role).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", role.StudentID);
     return(View(role));
 }
 public ActionResult Edit([Bind(Include = "QuestionId,DepartmentCode,CourseCode,SectionNumber,Question,Option1,Option2,Option3,Option4,Type")] Test test)
 {
     if (ModelState.IsValid)
     {
         db.Entry(test).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Type = new SelectList(db.Types, "TypeID", "TypeName", test.Type);
     return(View(test));
 }
Пример #14
0
 public ActionResult Edit([Bind(Include = "TaskNumber,DepartmentCode,CourseCode,SectionNumber,Semester,Year,TaskHeader,TaskDetails,Type")] Task task)
 {
     if (ModelState.IsValid)
     {
         db.Entry(task).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Sections, "DepartmentCode", "DepartmentCode", task.DepartmentCode);
     ViewBag.Type           = new SelectList(db.Types, "TypeID", "TypeName", task.Type);
     return(View(task));
 }
Пример #15
0
 public ActionResult Edit([Bind(Include = "DepartmentCode,CourseCode,SectionNumber,Semester,Year,InstructorID")] Section section)
 {
     if (ModelState.IsValid)
     {
         db.Entry(section).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Courses, "DepartmentCode", "CourseTitle", section.DepartmentCode);
     ViewBag.InstructorID   = new SelectList(db.Instructors, "InstructorID", "InstructorName", section.InstructorID);
     return(View(section));
 }
Пример #16
0
 public ActionResult Edit(Task task)
 {
     if (ModelState.IsValid)
     {
         db.Entry(task).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentCode = new SelectList(db.Departments, "DepartmentCode", "DepartmentCode", task.DepartmentCode);
     ViewBag.CourseCode     = new SelectList(db.Sections, "CourseCode", "CourseCode", task.CourseCode);
     ViewBag.SectionNumber  = new SelectList(db.Sections, "SectionNumber", "SectionNumber", task.SectionNumber);
     ViewBag.Semester       = new SelectList(db.Sections, "Semester", "Semester", task.Semester);
     ViewBag.Year           = new SelectList(db.Sections, "Year", "Year", task.Year);
     ViewBag.Type           = new SelectList(db.Types, "TypeID", "TypeID", task.Type);
     return(View(task));
 }