コード例 #1
0
 public ActionResult SignUpCandidate(CandidateEmployee candidate)
 {
     if (ModelState.IsValid)
     {
         int result = candidatedbhelper.AddCandidate(candidate);
         if (result > 0)
         {
             ViewBag.Issuccess = "Registered Successfully";
             ModelState.Clear();
             return(View());
             //return RedirectToAction("Login", "NucesJobAccount");
         }
         else
         {
             ViewBag.Issuccess = "Problem Registering";
             ModelState.Clear();
             return(View());
         }
     }
     else
     {
         ModelState.AddModelError("", "Invalid Data");
         return(View());
     }
 }
コード例 #2
0
ファイル: CandidateDb.cs プロジェクト: sohail9987/IPTProject
        public int AddCandidate(CandidateEmployee candidate)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data["EName"]           = candidate.EName;
            data["EAddress"]        = candidate.EAddress;
            data["MobileNumber"]    = candidate.MobileNumber;
            data["EducationLevel"]  = candidate.EducationalLevel;
            data["ExperienceYears"] = candidate.ExperienceYears;
            data["CVpath"]          = candidate.CVPath;
            data["Coverletterpath"] = candidate.CoverLetterPath;
            data["EPassword"]       = candidate.Epassword;
            data["Email"]           = candidate.Email;
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://localhost:44380/api/");
                var responseTask = client.PostAsJsonAsync("Candidate/AddCandidate", data);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.StatusCode == HttpStatusCode.Created)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
コード例 #3
0
        public byte[] GetCandidate()
        {
            CandidateEmployee employe = new CandidateEmployee();

            employe.Name     = "John";
            employe.LastName = "Smith";
            employe.Address  = "Erevan";
            employe.Email    = "Mail.am";
            employe.Phone    = "0778878787";
            CandidateEmployee employe1 = new CandidateEmployee();

            employe1.Name     = "Narek";
            employe1.LastName = "Narekyan";
            employe1.Address  = "New York";
            employe1.Email    = "Mail.com";
            employe1.Phone    = "0778878787";

            Candidate candidate = new Candidate();

            candidate.ListofCandidate.Add(employe);
            candidate.ListofCandidate.Add(employe1);
            if (candidate == null)
            {
                return(null);
            }
            XmlSerializer XmlFormatter = new XmlSerializer(typeof(Candidate));

            using (MemoryStream ms = new MemoryStream())
            {
                XmlFormatter.Serialize(ms, candidate);
                return(ms.ToArray());
            }
        }