public ActionResult Edit(Student student, HttpPostedFileBase image)
 {
     if(ModelState.IsValid)
     {
         student.SaveImage(image, Server.MapPath("~"), "/ProfileImages/");
         studentRepo.InsertOrUpdate(student);
         return RedirectToAction("Index");
     }
     return View();
 }
 public ActionResult Create(Student student, HttpPostedFileBase image)
 {
     if (ModelState.IsValid)
     {
         student.SaveImage(image, Server.MapPath("~"), "/ProfileImages/");
         studentRepo.InsertOrUpdate(student);
         return RedirectToAction("Index");
         // alternative (not recommendable because if we change the list in View we have to change it here too):
         // return View("Index"), db.Students.ToList();
     }
     return View();
 }
        private void saveStudentWithImageAndCompetency(Student student, HttpPostedFileBase image, IEnumerable<int> compIds, int eduId)
        {
            string path = Server != null ? Server.MapPath("~") : "";
            student.SaveImage(image, path, "/ProfileImages/");

            //TODO check if i actually need these 2 lines:
            // get competencies
            student.Competencies = competencyRepository.All.Where(x => compIds.Contains(x.CompetencyId)).ToList();
            // get education
            student.Education = educationRepository.Find(eduId);

            studentRepository.InsertOrUpdate(student);
        }