示例#1
0
        public ActionResult EditCandidate(FormCollection form)
        {
            if (!user.IsManager())
            {
                return(View("Error"));
            }
            int    id_student = Convert.ToInt32(form["CandidateID"]);
            string Password   = form["Password"];

            string Email             = form["Email"];
            string Name              = form["Name"];
            string Gender            = form["Gender"];
            string Birthday          = form["Birthday"];
            string Phone             = form["Phone"];
            string Address           = form["Address"];
            string Education_Details = form["Education_Details"];
            string Work_Experience   = form["Work_Experience"];

            int edit = managerDal.EditCandidate(id_student, Address, Password, Email, Name, Gender, Birthday, Phone, Education_Details, Work_Experience);

            if (edit == 1)
            {
                TempData["CandidateID"] = true;
                TempData["statusEdit"]  = "The edit was successful";
            }
            if (edit == 5)
            {
                TempData["CandidateID"] = true;
                TempData["statusEdit"]  = "Under 18 years old or an invalid date of birth";
            }

            if (edit == 4)
            {
                TempData["CandidateID"] = false;
                TempData["statusEdit"]  = "This phone already exists !!";
            }

            if (edit == 3)
            {
                TempData["CandidateID"] = false;
                TempData["statusEdit"]  = "This email already exists !!";
            }
            return(RedirectToAction("EditCandidate/" + id_student));
        }