public async Task GivenHappyPath_WhenGetAllCandidates_ThenCandidatesAreReturned() { using (_server) { var client = await InitClient(_server); var DTOCreated = new CandidateDto( Guid.NewGuid().ToString(), "Janneke", "Janssens", "*****@*****.**", "0470000000", "janneke", "janneke", "jannekeComment"); var content = JsonConvert.SerializeObject(DTOCreated); var stringContent = new StringContent(content, Encoding.UTF8, "application/json"); var response = await client.GetAsync("api/candidates"); response.EnsureSuccessStatusCode(); Assert.Equal("OK", response.StatusCode.ToString()); } }
public async Task InsertOrUpdateCandidate(CandidateDto input) { var currentUser = await GetCurrentUserAsync(); if (!(await UserManager.IsInRoleAsync(currentUser, StaticRoleNames.Host.HR) || await UserManager.IsInRoleAsync(currentUser, StaticRoleNames.Host.Admin))) { throw new UserFriendlyException(ErrorCodes.Forbidden.AddOrEditCandidate); } if (input.Id != 0) { var interviewers = WorkScope.GetAll <InterviewCandidates>().Where(c => c.CvcandidateId == input.Id.Value); foreach (var inter in interviewers) { await WorkScope.GetRepo <InterviewCandidates, long>().DeleteAsync(inter); } var skills = WorkScope.GetAll <CVSkills>().Where(c => c.CvcandidateId == input.Id.Value); foreach (var skill in skills) { await WorkScope.GetRepo <CVSkills, long>().DeleteAsync(skill); } } var candidateId = await WorkScope.InsertOrUpdateAndGetIdAsync(ObjectMapper.Map <CVCandidates>(input)); if (input.Attachments != null && input.Attachments.Count > 0) { await InsertOrUpdateAttachments(input.Attachments, candidateId); } }
public async Task GivenNewCandidateJsonWithoutName_WhenCreatingNewCandidate_ThenReturnBadRequest() { using (_server) { var client = await InitClient(_server); var newDTOCreated = new CandidateDto() { FirstName = "", LastName = "Parker", Email = "*****@*****.**", PhoneNumber = "0470000000", GitHubUsername = "******", LinkedIn = "peterparker" }; var content = JsonConvert.SerializeObject(newDTOCreated); var stringContent = new StringContent(content, Encoding.UTF8, "application/json"); var response = await client.PostAsync("api/Candidates", stringContent); var responseString = await response.Content.ReadAsStringAsync(); Assert.Equal("BadRequest", response.StatusCode.ToString()); } }
public async Task GivenGetCandidate_WhenPassingExistingId_ThenReturnCandidate() { using (_server) { var client = await InitClient(_server); var newDTOCreated = new CandidateDto() { FirstName = "Joske", LastName = "Parker", Email = "*****@*****.**", PhoneNumber = "0470000000", GitHubUsername = "******", LinkedIn = "peterparker" }; var content = JsonConvert.SerializeObject(newDTOCreated); var stringContent = new StringContent(content, Encoding.UTF8, "application/json"); var response = await client.PostAsync("api/Candidates", stringContent); response.EnsureSuccessStatusCode(); var creatingResponseString = await response.Content.ReadAsStringAsync(); var createdCandidate = JsonConvert.DeserializeObject <CandidateDto>(creatingResponseString); var getResponse = await client.GetAsync("/api/Candidates/" + createdCandidate.Id); var responseString = await getResponse.Content.ReadAsStringAsync(); var foundCandidate = JsonConvert.DeserializeObject <CandidateDto>(responseString); Assert.Equal(newDTOCreated.FirstName, foundCandidate.FirstName); } }
public ActionResult <CandidateDto> CreateCandidate([FromBody] CandidateDto candidateDto) { var newcandidate = _candidateMapper.ToDto( _candidateService.AddCandidate( _candidateMapper.ToDomain(candidateDto))); return(Created($"api/candidate/{newcandidate.Id}", newcandidate)); }
/// <summary> /// Get a single candidate /// </summary> /// <param name="id"></param> /// <returns>A <see cref="CandidateDto"/> if a candidate exists, else null</returns> public CandidateDto GetCandidate(int id) { CandidateDto candidateDto = _db.Candidates .Where(c => c.Id == id) .Select(this.CreateDto) .SingleOrDefault(); return(candidateDto); }
public async Task RegisterCandidate(CandidateDto input) { var candidate = _candidateRepository.FirstOrDefault(input.Id); if (candidate != null) { candidate.IsRegistered = true; await _candidateRepository.UpdateAsync(candidate); } }
public Candidate DtoToDomain(CandidateDto candidateDto) { var id = candidateDto.Id; if (candidateDto.Id == null) { id = Guid.NewGuid().ToString(); } return(new Candidate(Guid.Parse(id), candidateDto.FirstName, candidateDto.LastName, new MailAddress(candidateDto.Email), candidateDto.Phone, candidateDto.LinkedIn, candidateDto.Comment)); }
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)); }
public List <FantasticReasonDto> GetReasonsByCandidate(CandidateDto candidateDto) { try { return(this.GetReasonsByCandidateId(candidateDto.Id)); } catch (Exception ex) { _logger.LogError(ex, "Error retrieving reasons by candidate"); throw ex; } }
public IActionResult Authenticate([FromBody] CandidateDto candidateDto) { _logger.LogInformation("Authentication"); var authentication = _candidateService.Authenticate(candidateDto.Email, candidateDto.Password); _logger.LogInformation("Authentication result: " + authentication); if (authentication == 1) { return(BadRequest(new { message = "Neteisingai įvestas elektroninio pašto adresas arba slaptažodis. Pataisykite ir bandykite prisijungti dar kartą." })); } if (authentication == 2) { return(BadRequest(new { message = "Šio interviu galiojimo laikas baigėsi." })); } if (authentication == 3) { return(BadRequest(new { message = "Šis interviu jau buvo atliktas." })); } // Prepare JWT token var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(_appSettings.JwtSecret); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, candidateDto.Email), new Claim(ClaimTypes.Role, "Candidate") }), Expires = DateTime.UtcNow.AddDays(1), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); var tokenString = tokenHandler.WriteToken(token); // Retriev application var application = _candidateService.GetApplicationId(candidateDto.Email, candidateDto.Password); // Return return(Ok(new { Username = application.CandidateName, Email = application.CandidateEmail, ApplicationId = application.Id, Token = tokenString })); }
public void addCandidate(CandidateDto candidate) { DateTime startTime = DateTime.Now; Candidate newCandidate = new Candidate { Fname = candidate.FirstName, Lname = candidate.LastName, StartTime = startTime, StatusId = (int)CandidateStatusEnum.New }; _context.Candidates.Add(newCandidate); _context.SaveChanges(); }
private async void RefreshCandidateList() { var candidates = await new ElectionConfigurationService().GetCandidateWithDetails(); foreach (var candidate in candidates) { var newcandidate = new CandidateDto(candidate.Id, Convert.ToInt32(candidate.PositionId) , candidate.CandidateName, Util.ByteToImageSource(candidate.CandidatePicture), Convert.ToInt32(candidate.RankId) , candidate.Position.PositionName); Candidates.Add(newcandidate); } CandidatesList.ItemsSource = Candidates; }
public IActionResult GetCandidate(int id) { CandidateDto candidateDto = _candidateService.GetCandidate(id); if (candidateDto == null) { // No resource by that id, so 404 return(new StatusCodeResult(404)); } else { return(new JsonResult(candidateDto) { StatusCode = 200 }); } }
public async Task <GenericResponse <Candidate> > AddCandidate(CandidateDto candidateDto) { try { var candidateObj = new Candidate() { Email = candidateDto.Email, Mobile = candidateDto.Mobile, Name = candidateDto.Name }; cbtAppDbContext.Candidates.Add(candidateObj); int recordsSaved = await cbtAppDbContext.SaveChangesAsync(); if (recordsSaved > 0) { return(new GenericResponse <Candidate>() { Code = 201, Data = candidateObj, Message = "Candidate created successfully!", Success = true }); } return(new GenericResponse <Candidate>() { Code = 200, Data = null, Message = "Candidate entry not created!", Success = false }); } catch (Exception ex) { Log.Error(Util.LogError(ex)); return(new GenericResponse <Candidate>() { Code = 500, Data = null, Message = ex.Message, Success = false }); } }
private async Task <CreateJobApplicationDto> PrepareNewJobApplicationTest(HttpClient client) { var newDTOCreatedCandidate = new CandidateDto() { FirstName = "Peter", LastName = "Parker", Email = "*****@*****.**", PhoneNumber = "0470000000", GitHubUsername = "******", LinkedIn = "peterparker" }; var contentCandidate = JsonConvert.SerializeObject(newDTOCreatedCandidate); var stringContentCandidate = new StringContent(contentCandidate, Encoding.UTF8, "application/json"); var responseCandidate = await client.PostAsync("api/Candidates", stringContentCandidate); var responseStringCandidate = await responseCandidate.Content.ReadAsStringAsync(); var createdCandidate = JsonConvert.DeserializeObject <CandidateDto>(responseStringCandidate); var newDTOCreatedCampaign = new CreateCampaignDto() { Name = "testCampaign", Client = "testClient", ClassStartDate = DateTime.Today.AddDays(6), StartDate = DateTime.Today.AddDays(5), Comment = "testComment" }; var contentCampaign = JsonConvert.SerializeObject(newDTOCreatedCampaign); var stringContentCampaign = new StringContent(contentCampaign, Encoding.UTF8, "application/json"); var responseCampaign = await client.PostAsync("api/campaigns", stringContentCampaign); var responseStringCampaign = await responseCampaign.Content.ReadAsStringAsync(); var createdCampaign = JsonConvert.DeserializeObject <CampaignDto>(responseStringCampaign); var newJobApplicationCreatedDto = new CreateJobApplicationDto( createdCandidate.Id, createdCampaign.Id ); return(newJobApplicationCreatedDto); }
public void GivenACreatedCandidateDto_WhenToDomain_ThenReturnCandidateObjectWithIdGuidAndEqualFirstName() { var DTOCreated = new CandidateDto( Guid.NewGuid().ToString(), "Janneke", "Janssens", "*****@*****.**", "0470000000", "janneke", "janneke", "jannekeComment"); var candidateMapper = new CandidateMapper(); //when var newDomain = candidateMapper.ToDomain(DTOCreated); //then Assert.IsType <Guid>(newDomain.Id); Assert.Equal(newDomain.FirstName, DTOCreated.FirstName); }
public bool HRMSResourceCreate(CandidateDto candidate) { if (candidate == null) { return(false); } var _candiateaddprofile = new Candidate { CandidateName = candidate.CandidateName, CandidateSkills = candidate.CandidateSkills, Email = candidate.Email, Phone = candidate.Phone, Address = candidate.Address, Experience = candidate.Experience, City = candidate.City, JobTitle = candidate.JobTitle, FilePath = candidate.FilePath, Annualsalary = candidate.Annualsalary, NoticePeriod = candidate.NoticePeriod, WorkRights = candidate.WorkRights, RecruiterComments = candidate.RecruiterComments, postcode = candidate.postcode, EmployeeStatus = candidate.EmployeeStatus, TechnicianLevel = candidate.TechnicianLevel, Availability = candidate.Availability, HourlyRate = candidate.HourlyRate, DailyRate = candidate.DailyRate, state = candidate.state, DateCreated = candidate.DateCreated, RateOfSkillExperties = candidate.RateOfSkillExperties, EmployementTypeId = candidate.EmployementTypeId, isactive = true, ADP_EmployeeID = candidate.ADP_EmployeeID, WarehouseID = candidate.WarehouseID }; _context.Candidate.Add(_candiateaddprofile); _context.SaveChanges(); return(true); }
public IActionResult SaveDetails([FromBody] CandidateDto candidateDto) { var email = this.User.Identities.First().Name; var candidate = _candidateRepository.GetSingle(c => c.Email == email); candidate.IsInformationFilled = true; candidate.FirstName = candidateDto.FirstName; candidate.LastName = candidateDto.LastName; candidate.Mobile = candidateDto.Mobile; candidate.City = candidateDto.City; candidate.Country = candidateDto.Country; candidate.College = candidateDto.College; candidate.Branch = candidateDto.Branch; candidate.CGPA = candidateDto.CGPA; candidate.CurrentCompany = candidateDto.CurrentCompany; candidate.ExperienceInYears = candidateDto.ExperienceInYears; candidate.PassingYear = candidateDto.PassingYear; candidate.State = candidateDto.State; _candidateRepository.Edit(candidate); _candidateRepository.Commit(); return(Ok(JsonConvert.SerializeObject("Saved"))); }
public int UploadCandidate(CandidateDto candidate) { var cv = new Cv { Contacts = new List <Contacts> { new Contacts { Phone = string.IsNullOrEmpty(candidate.Contacts.Phone) ? "" : candidate.Contacts.Phone, Site = string.IsNullOrEmpty(candidate.Contacts.Site) ? "" : candidate.Contacts.Site, Email = string.IsNullOrEmpty(candidate.Contacts.Email) ? "" : candidate.Contacts.Email, Skype = string.IsNullOrEmpty(candidate.Contacts.Skype) ? "" : candidate.Contacts.Skype } }, DateOfBirth = candidate.DateOfBirth, Fio = candidate.Fio, Skills = candidate.Skills.Select(s => new Skills() { Name = s }).ToList(), Area = candidate.Area, Internal = false, Source = string.Empty, Status = candidate.Status, Type = candidate.Type }; cv.Area = string.Empty; cv.Label = candidate.Label; cv.Salary = string.Empty; _context.Cv.Add(cv); _context.SaveChanges(); return(cv.Id); }
public PlacementDto() { BillingClientContact = new ClientContactDto(); Candidate = new CandidateDto(); JobOrder = new JobOrderDto(); }
public async Task <HttpResponseMessage> PostCandidate(CandidateDto candidateDto) { return(await _HttpClient.PostAsync( ApiRoutes.CandidatesRoute, candidateDto.ToStringContent())); }
private static void ExtendCandidateModel(CandidateDto model) { model.Avatar = model.Files.SingleOrDefault(x => x.FileType == FileType.Avatar); model.Resume = model.Files.SingleOrDefault(x => x.FileType == FileType.Resume); model.Files = null; }
public AppointmentDto() { CandidateReference = new CandidateDto(); JobOrder = new JobOrderDto(); Owner = new UserDto(); }
public async Task <CandidateDto> CreateCandidate(CandidateDto candidateDto) { var createdCandidate = await _CandidateRepository.InsertCandidate(_Mapper.Map <Candidate>(candidateDto)); return(_Mapper.Map <CandidateDto>(createdCandidate)); }
public bool HRMSResourceEdit(CandidateDto candidate) { bool returnflag = false; var _CandidateEdit = _context.Candidate.Where(c => c.ID == candidate.ID).FirstOrDefault(); if (_CandidateEdit != null && candidate != null) { if (_CandidateEdit.CandidateName != candidate.CandidateName) { _CandidateEdit.CandidateName = candidate.CandidateName; } if (_CandidateEdit.CandidateSkills != candidate.CandidateSkills) { _CandidateEdit.CandidateSkills = candidate.CandidateSkills; } if (_CandidateEdit.Email != candidate.Email) { _CandidateEdit.Email = candidate.Email; } if (_CandidateEdit.Phone != candidate.Phone) { _CandidateEdit.Phone = candidate.Phone; } if (_CandidateEdit.Address != candidate.Address) { _CandidateEdit.Address = candidate.Address; } if (_CandidateEdit.Experience != candidate.Experience) { _CandidateEdit.Experience = candidate.Experience; } if (_CandidateEdit.City != candidate.City) { _CandidateEdit.City = candidate.City; } if (_CandidateEdit.postcode != candidate.postcode) { _CandidateEdit.postcode = candidate.postcode; } if (_CandidateEdit.JobTitle != candidate.JobTitle) { _CandidateEdit.JobTitle = candidate.JobTitle; } if (_CandidateEdit.PayFrequency != candidate.PayFrequency) { _CandidateEdit.PayFrequency = candidate.PayFrequency; } if (_CandidateEdit.ADP_EmployeeID != Convert.ToInt32(candidate.ADP_EmployeeID)) { _CandidateEdit.ADP_EmployeeID = Convert.ToInt32(candidate.ADP_EmployeeID); } if (_CandidateEdit.AssignResource != candidate.AssignResource) { _CandidateEdit.AssignResource = candidate.AssignResource; } if (_CandidateEdit.WorkRights != candidate.WorkRights) { _CandidateEdit.WorkRights = candidate.WorkRights; } if (_CandidateEdit.RecruiterComments != candidate.RecruiterComments) { _CandidateEdit.RecruiterComments = candidate.RecruiterComments; } if (_CandidateEdit.Availability != candidate.Availability) { _CandidateEdit.Availability = candidate.Availability; } if (_CandidateEdit.EmployeeStatus != candidate.EmployeeStatus) { _CandidateEdit.EmployeeStatus = candidate.EmployeeStatus; } if (_CandidateEdit.EmployementType != candidate.EmployementType) { _CandidateEdit.EmployementType = candidate.EmployementType; } if (_CandidateEdit.EmployementTypeId != candidate.EmployementTypeId) { _CandidateEdit.EmployementTypeId = candidate.EmployementTypeId; } if (_CandidateEdit.DailyRate != candidate.DailyRate) { _CandidateEdit.DailyRate = candidate.DailyRate; } if (_CandidateEdit.HourlyRate != candidate.HourlyRate) { _CandidateEdit.HourlyRate = candidate.HourlyRate; } if (_CandidateEdit.TechnicianLevel != candidate.TechnicianLevel) { _CandidateEdit.TechnicianLevel = candidate.TechnicianLevel; } if (_CandidateEdit.NoticePeriod != candidate.NoticePeriod) { _CandidateEdit.NoticePeriod = candidate.NoticePeriod; } if (_CandidateEdit.state != candidate.state) { _CandidateEdit.state = candidate.state; } if (_CandidateEdit.WarehouseID != candidate.WarehouseID) { _CandidateEdit.WarehouseID = candidate.WarehouseID; } if (_CandidateEdit.RateOfSkillExperties != candidate.RateOfSkillExperties) { _CandidateEdit.RateOfSkillExperties = candidate.RateOfSkillExperties; } if (_CandidateEdit.EmployementTypeId != candidate.EmployementTypeId) { _CandidateEdit.EmployementTypeId = candidate.EmployementTypeId; } _context.SaveChanges(); returnflag = true; } return(returnflag); }
public async Task <CandidateDto> PostCandidate([FromBody] CandidateDto candidateDto) { return(await _CandidateManager.CreateCandidate(candidateDto)); }
private void AssertCampaignIsEqual(CandidateDto candidateToCompare, CandidateDtoWithoutId candidateReference) { Assert.Equal(candidateToCompare.Email, candidateReference.Email); Assert.Equal(candidateToCompare.LastName, candidateReference.LastName); Assert.Equal(candidateToCompare.FirstName, candidateReference.FirstName); }
public async Task <CandidateDto> UpdateCandidate(CandidateDto candidate) { var updatedCandidate = await _CandidateRepository.UpdateCandidate(_Mapper.Map <Candidate>(candidate)); return(_Mapper.Map <CandidateDto>(updatedCandidate)); }
public async Task <ActionResult> UploadCandidate([FromBody] CandidateDto candidate) { var id = _candidatesRepo.UploadCandidate(candidate); return(Content($"{{ \"id\" : {id} }}", "application/json")); }
public Task <ActionResult <CandidateDto> > Update(CandidateDto objectToUpdate) { throw new NotImplementedException(); }