Beispiel #1
0
 public ActionResult Edit(StudentExperience studentexperience)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentexperience).State = EntityState.Modified;
         db.SaveChanges();
     }
     return(RedirectToAction("MyExperience", "StudentProfile", new { student_id = studentexperience.student_id }));
 }
Beispiel #2
0
        public ActionResult Edit(int id = 0)
        {
            StudentExperience studentexperience = db.StudentExperiences.ToList().Where(p => p.id == id && p.student_id.ToString() == User.Identity.Name).SingleOrDefault();

            if (studentexperience == null)
            {
                return(HttpNotFound("The record you selected does not exist. Please refresh the page."));
            }
            PrepareList();
            return(View(studentexperience));
        }
Beispiel #3
0
        public ActionResult Delete(int id = 0)
        {
            StudentExperience studentexperience = db.StudentExperiences.ToList().Where(p => p.id == id && p.student_id.ToString() == User.Identity.Name).SingleOrDefault();
            var student_id = studentexperience.student_id;

            if (studentexperience == null)
            {
                return(HttpNotFound("The record you selected does not exist. Please refresh the page."));
            }
            db.StudentExperiences.Remove(studentexperience);
            db.SaveChanges();
            return(RedirectToAction("MyExperience", "StudentProfile", new { student_id = student_id }));
        }
Beispiel #4
0
 public ActionResult Create(StudentExperience studentexperience)
 {
     if (ModelState.IsValid)
     {
         db.StudentExperiences.Add(studentexperience);
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return(HttpNotFound("Failed to add experience.<br/><br/>" + e.Message));
         }
     }
     return(RedirectToAction("MyExperience", "StudentProfile", new { student_id = studentexperience.student_id }));
 }
Beispiel #5
0
        public ActionResult Create(int id = 0)
        {
            var type    = db.StudentExperienceTypes.Find(id);
            var student = db.StudentProfiles.Find(User.Identity.Name);

            if (student == null || type == null)
            {
                return(HttpNotFound("Student Profile or Experience Type not found."));
            }
            StudentExperience studentexperience = new StudentExperience
            {
                type_id               = id,
                student_id            = student.id,
                StudentProfile        = student,
                StudentExperienceType = type
            };

            PrepareList();
            return(View(studentexperience));
        }