private Member CreateMember(MemberReq employeeMember) { if (_mRepo.Exists(employeeMember.Cpr)) { throw new MemberAlreadyExistsException(); } var member = MemberFactory(employeeMember); member.AddMembership(new PaymentMethod()); return(member); }
private static Member MemberFactory(MemberReq memberReq) { return(memberReq switch { EmployeeReq e => new Employee(e.Cpr, e.Name, e.Address, e.Phone, e.Company, e.Email, e.Magazine), MemberReq m => new Member(m.Cpr, m.Name) });