public string Post([FromBody] UserPolicyDTO userpolicy) { var result = _unitOfWork.UserPolicies.AddUserPolicy(userpolicy); _unitOfWork.Complete(); return(result); }
public string AddUserPolicy(UserPolicyDTO userPolicy) { try { foreach (var policy in userPolicy.PolicyIds) { _context.UserPolicies.Add(new UserPolicyModel { PolicyId = policy, InsuredId = userPolicy.UserId, }); } return("ok"); } catch (Exception) { return("error"); }; }