Пример #1
0
        public ActionResult CreateCandidate(FormCollection form)
        {
            if (!user.IsManager())
            {
                return(View("Error"));
            }
            // Model.UpdateLastSeen("Thêm Sinh Viên", Url.Action("AddStudent"));
            string Username = form["Email"];
            string Password = form["Phone"];

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


            int add = managerDal.AddCandidate(Username, Password, 3, Address, Email, Name, Gender, Birthday, Phone, Education_Details, Work_Experience, 0);

            if (add == 1)
            {
                TempData["CandidateID"] = true;
                TempData["statusCC"]    = "Create success";
            }
            if (add == 5)
            {
                TempData["CandidateID"] = true;
                TempData["statusCC"]    = "Under 18 years old or an invalid date of birth.";
            }

            if (add == 3)
            {
                TempData["CandidateID"] = false;
                TempData["statusCC"]    = "This email already exists !!";
            }
            if (add == 4)
            {
                TempData["CandidateID"] = false;
                TempData["statusCC"]    = "This phone already exists !!";
            }
            if (add == 0)
            {
                TempData["CandidateID"] = false;
                TempData["statusCC"]    = "Create failed";
            }
            return(RedirectToAction("CreateCandidate"));
        }