Beispiel #1
0
        public async Task <IActionResult> Post(CandidateDto candidateObj)
        {
            var candidate = await _candidateRepository.AddCandidate(candidateObj);

            if (candidate.Code == 201)
            {
                return(StatusCode(StatusCodes.Status201Created, candidate));
            }

            return(StatusCode(StatusCodes.Status500InternalServerError, candidate));
        }
Beispiel #2
0
        public IResult AddCandidate(CandidateViewModel candidateViewModel, CandidateDocumentViewModel candidateDocumentViewModel)
        {
            var result = new Result
            {
                Operation = Operation.Create,
                Status    = Status.Success
            };

            try
            {
                var candidateModel = new Candidates();
                candidateModel.MapFromViewModel(candidateViewModel, (ClaimsIdentity)_principal.Identity);
                candidateModel.QualificationId = candidateViewModel.Qualification;

                #region Insert OpeningCandidate
                var openingCandidate = new OpeningCandidates();
                openingCandidate.OpeningId = candidateViewModel.OpeningId;
                openingCandidate.Candidate = candidateModel;
                openingCandidate.MapAuditColumns((ClaimsIdentity)_principal.Identity);
                #endregion

                #region Insert Organization
                Organizations organization = null;
                if (candidateViewModel.OrganizationId != 0)
                {
                    candidateModel.OrganizationId = candidateViewModel.OrganizationId;
                }
                else
                {
                    organization = new Organizations
                    {
                        Name = candidateViewModel.OrganizationName
                    };
                    organization.MapAuditColumns((ClaimsIdentity)_principal.Identity);
                    candidateModel.Organisation = organization;
                }
                #endregion

                #region Insert Candidate Document
                var candidateDocumentModel = new CandidateDocuments();
                candidateDocumentModel.MapFromViewModel(candidateDocumentViewModel, (ClaimsIdentity)_principal.Identity);
                candidateModel.CandidateDocuments.Add(candidateDocumentModel);
                #endregion

                _candidateRepository.AddCandidate(candidateModel, openingCandidate);
                result.Body = candidateModel.CandidateId;
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Error;
            }
            return(result);
        }
Beispiel #3
0
 public ActionResult AddCandidate(Candidate m_Cand, HttpPostedFileBase fileUpload)
 {
     if (ModelState.IsValid)
     {
         int m_Id = CandidateRepository.AddCandidate(m_Cand, fileUpload);
         return(RedirectToAction("/DisplayCandidate/" + m_Id));
     }
     else
     {
         ViewBag.Companies = CompanyRepository.RetrieveAll();
         return(View("AddCandidate", m_Cand));
     }
 }
        public ActionResult MakeCand(int id)
        {
            Staff     m_Staff     = StaffRepository.RetrieveOne(id);
            Candidate m_Candidate = new Candidate();

            m_Candidate.FirstName = m_Staff.FirstName;
            m_Candidate.LastName  = m_Staff.LastName;
            m_Candidate.CompanyId = m_Staff.CompanyId;
            m_Candidate.Email     = m_Staff.Email;
            m_Candidate.Date      = m_Staff.DateEntered;

            CandidateRepository.AddCandidate(m_Candidate, null);
            StaffRepository.DeleteStaff(id);

            return(Redirect("/Companies/DisplayCompany/" + m_Staff.CompanyId));
        }
Beispiel #5
0
        public Guid AddCandidate(CandidateValueObject candidate)
        {
            var candidateEntity = new Models.Candidate
            {
                Address        = candidate.Address,
                Cpf            = candidate.Cpf,
                JobOpportunity = _jobOpportunityService.GetJobOpportunity(candidate.JobOpportunityId),
                Name           = candidate.Name,
                Phone          = candidate.Phone,
                Tecnologies    = candidate.Tecnologies.Select(c => new CandidateTecnology
                {
                    Tecnology = _tecnologyService.GetTecnology(c)
                }).ToList()
            };

            return(candidateEntity.IsValid() ? _candidateRepository.AddCandidate(candidateEntity) : Guid.Empty);
        }
Beispiel #6
0
 /// <summary>
 /// This is the method for Add Candidate.
 /// </summary>
 /// <param name="requestModel"></param>
 /// <returns></returns>
 public CandidateResponseModel AddCandidate(CandidateRequestModel requestModel)
 {
     try
     {
         if (requestModel != null)
         {
             return(candidateRL.AddCandidate(requestModel));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #7
0
 /// <summary>
 /// It add Candidate
 /// </summary>
 /// <param name="addCandidate">Candidate Name and Constituency Id and PartyId</param>
 /// <returns>AddCandidateResponseModel</returns>
 public AddCandidateResponseModel AddCandidate(AddCandidateRequestModel addCandidate)
 {
     try
     {
         if (addCandidate == null)
         {
             return(null);
         }
         else
         {
             return(_candidateRepository.AddCandidate(addCandidate));
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
        public async Task <IActionResult> AddCandidate([FromBody] Candidate candidateToAdd)
        {
            if (candidateToAdd == null)
            {
                return(BadRequest(ModelState));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!await _candidateRepository.AddCandidate(candidateToAdd))
            {
                ModelState.AddModelError("", $"Something went wrong saving{candidateToAdd.Name}");
                return(StatusCode(500, ModelState));
            }

            return(StatusCode(201));
        }
        public IActionResult PostCandidate([FromBody] CandidateViewModel candidateVW)
        {
            int Id;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            candidateVW.candidate.AddrId    = _addressRepository.AddAddress(candidateVW.address);
            candidateVW.candidate.ContactId = _contactRepository.AddContact(candidateVW.contact);

            Id = _candidateRepository.AddCandidate(candidateVW.candidate);
            var activationCode = new Guid();

            EmailService.SendVerificationLinkEmail(candidateVW.contact.Email, activationCode.ToString(), "http", "", "");


            return(CreatedAtAction("PostCandidate", new { id = Id }, candidateVW.candidate));
        }
        public async Task <IActionResult> Create([FromBody] CreateViewModel candidate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                await _candidateRepository.AddCandidate(candidate);
            }
            catch (DbUpdateException ex)
            {
                return(BadRequest(ex));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(Ok(candidate));
        }
Beispiel #11
0
 public async Task <int> AddCandidate(Candidate candidate)
 {
     return(await _candidateRepository.AddCandidate(candidate));
 }
        public async Task <Candidate> CreateCandidate(Candidate newCandidateToCreate)
        {
            var createdCandidate = await _candidateRepository.AddCandidate(newCandidateToCreate);

            return(createdCandidate);
        }
 public Candidate AddCandidate(Candidate candidate)
 {
     return(_candidateRepository.AddCandidate(candidate));
 }
Beispiel #14
0
 /// <summary>
 /// Adding new candidate
 /// </summary>
 /// <param name="candidate"></param>
 /// <returns></returns>
 public async Task <bool> AddCandidate(AddCandidateDto candidate)
 {
     return(await _candidateRepository.AddCandidate(candidate));
 }
 public void AddCandidate(CandidateViewModel model)
 {
     _candidateRepository.AddCandidate(model);
     return;
 }
Beispiel #16
0
 public void Post([FromBody] Candidate candidate)
 {
     _candidateRepository.AddCandidate(candidate);
 }