Exemplo n.º 1
0
        // GET candidate by id
        public InterviewCandidate Get(string id)
        {
            IList <InterviewCandidate> allCandidates = service.GetAllCandidates();
            InterviewCandidate         candidate     = allCandidates.Where(c => c.Id == id).FirstOrDefault();

            return(candidate);
        }
Exemplo n.º 2
0
        // delete the candidate
        public void Delete(string id)
        {
            IList <InterviewCandidate> allCandidates = service.GetAllCandidates();
            InterviewCandidate         candidate     = allCandidates.Where(c => c.Id == id).FirstOrDefault();

            allCandidates.Remove(candidate);

            // call the service method to delete the values.
            service.SaveChanges(allCandidates);
        }
Exemplo n.º 3
0
        // update existing candidate
        public void Put(InterviewCandidate candidate)
        {
            //sample logic
            IList <InterviewCandidate> allCandidates    = service.GetAllCandidates();
            InterviewCandidate         oldCandidateData = allCandidates.Where(c => c.Id == candidate.Id).FirstOrDefault();

            allCandidates.Remove(oldCandidateData);
            allCandidates.Add(candidate);

            // call the service method to update the values.
            service.SaveChanges(allCandidates);
        }
Exemplo n.º 4
0
        // Add new candidate
        public void Post([FromBody] InterviewCandidate candidate)
        {
            // call the service method to save the values.

            //sample logic
            IList <InterviewCandidate> allCandidates = service.GetAllCandidates();

            allCandidates.Add(candidate);

            // call the service method to save the values.
            service.SaveChanges(allCandidates);
        }