Beispiel #1
0
        public async Task <IActionResult> PutApplicant(int id, Applicant applicant)
        {
            if (id != applicant.ID)
            {
                _logger?.LogDebug($"PUT - The object with ID:\"{applicant.ID}\" does not match with the given ID:\"{id}\".");
                return(BadRequest());
            }

            var result = await _service.UpdateAsync(applicant);

            if (result == null)
            {
                _logger?.LogDebug($"PUT - Applicant with ID:\"{id}\" not found!");
                return(NotFound());
            }
            return(Ok());
        }
Beispiel #2
0
        public async Task UpdateApplicant()
        {
            IApplicantDomainService service = GetService <IApplicantDomainService>();
            var applicant = new Applicant {
                Name = "Ali_1", FamilyName = "Hosseini", Address = "Address test", Age = 35, CountryOfOrigin = "Aruba", EMailAddress = "*****@*****.**"
            };
            await service.CreateAsync(applicant);

            var result = await service.GetAsync(applicant.ID);

            result.Name = "Ali_2";
            await service.UpdateAsync(result);

            var updatedResult = await service.GetAsync(applicant.ID);

            Assert.NotNull(updatedResult);
            Assert.Equal("Ali_2", result.Name);
        }