public async Task <ActionResult> Put(int id, [FromBody] PolicyCreationDTO policyCreation)
        {
            var policy = mapper.Map <Policy>(policyCreation);

            policy.Id = id;
            context.Entry(policy).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <ActionResult> Post([FromBody] PolicyCreationDTO policyCreation)
        {
            var policy = mapper.Map <Policy>(policyCreation);

            context.Add(policy);
            await context.SaveChangesAsync();

            var policyDTO = mapper.Map <PolicyDTO>(policy);

            return(new CreatedAtRouteResult("getPolicy", new { policyDTO.Id }, policyDTO));
        }
        private List <PolicyCoverage> MapPolicyCoverage(PolicyCreationDTO policyCreationDTO, Policy policy)
        {
            var result = new List <PolicyCoverage>();

            foreach (var id in policyCreationDTO.CoverageIds)
            {
                result.Add(new PolicyCoverage()
                {
                    CoverageId = id
                });
            }
            return(result);
        }