public async Task <IActionResult> PostAsync(Transfer_Insurance insurance)
        {
            _logger.LogInformation($"Adding new insurance.");
            Inner_Insurance transformedInsurance = new Inner_Insurance
            {
                InsuranceId   = 0,
                InsuranceName = insurance.InsuranceName
            };
            await _insuranceRepository.AddInsuranceAsync(transformedInsurance);

            return(CreatedAtAction(nameof(GetByIdAsync), new { id = insurance.InsuranceId }, insurance));
        }
        public async Task <IActionResult> PutAsync(int id, [FromBody] Transfer_Insurance insurance)
        {
            _logger.LogInformation($"Editing insurance with id {id}.");
            var entity = await _insuranceRepository.GetInsuranceByIdAsync(id);

            if (entity is Inner_Insurance)
            {
                entity.InsuranceName = insurance.InsuranceName;

                return(NoContent());
            }
            _logger.LogInformation($"No insurances found with id {id}.");
            return(NotFound());
        }
Пример #3
0
 public void CheckInsurance(Transfer_Insurance insurance)
 {
 }