Beispiel #1
0
        public async Task <IActionResult> EditInsurance(int id, [FromBody] InsuranceForCreationDto insurance)
        {
            var _insurance = await _repo.GetInsurance(id);

            _mapper.Map(insurance, _insurance);
            if (await _repo.SaveAll())
            {
                return(NoContent());
            }
            return(BadRequest());
        }
Beispiel #2
0
        public async Task <IActionResult> CreateInsurance([FromBody] InsuranceForCreationDto InsuranceForCreationDTO)
        {
            var insurance = _mapper.Map <Insurance>(InsuranceForCreationDTO);

            _repo.Add(insurance);
            if (await _repo.SaveAll())
            {
                return(Ok(insurance));
            }
            return(BadRequest());
        }