public async void UpdateApplicantTest() { await _applicantService.UpdateApplicant(new December2020.Domain.Applicant.Models.UpdateApplicantRequest { Id = 1, Name = "testCreate", Address = "testCreateAddress" }); var findResult = this._context.Applicants.SingleOrDefault(x => x.Id == 1); Assert.NotNull(findResult); Assert.Equal(1, findResult.Id); }
public async Task <IActionResult> Update(UpdateApplicantDto model, int id) { model.ApplicantId = id; var applicantService = new ApplicantService(_unitOfWork); var response = await applicantService.UpdateApplicant(model); if (!response.Success) { _logger.LogInformation($"Bad request on update of an applicant with id {id}."); return(BadRequest(response)); } _logger.LogInformation($"Update request was made by applicant with id ${response.Data.ID}."); return(Ok(response)); }
protected async Task HandleValidSubmit() { Applicant result = null; if (Applicant.ID != 0) { result = await ApplicantService.UpdateApplicant(Applicant); } else { result = await ApplicantService.CreateApplicant(Applicant); } if (result != null) { NavigationManager.NavigateTo("/"); } }
public async Task ShouldUpdateApplicantInformation() { var applicant = new Applicant { Address = "Address", Age = 20, CountryOfOrigin = "Germany", EMailAddress = "*****@*****.**", FamilyName = "James", Hired = true, ID = _ID, Name = "James" }; var applicantResult = await applicantService.UpdateApplicant(applicant); Assert.IsNotNull(applicantResult); Assert.AreEqual(ResultCode.SUCCESS, applicantResult.ResponseCode); Assert.AreEqual("James", applicantResult.Result.Name); }
public ActionResult SaveRecord(Applicant applicant) { if (!string.IsNullOrWhiteSpace(SelectedStateAbbreviation)) { applicant.State = SelectedStateAbbreviation; } var errors = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { x.Key, x.Value.Errors }).ToArray(); if (applicant.Id != 0) { applicantService.UpdateApplicant(applicant); } else { applicantService.SaveApplicant(applicant); } if (!string.IsNullOrWhiteSpace(_filename)) { applicantService.PostResume(_filename, applicant); } return(RedirectToAction("Index", "Applicant")); }