public static Customer ConverttoEntity(CustomerModel incustomer)
 {
     Customer customer = null;
        try
        {
        EngineerRepository erepo = new EngineerRepository();
        InstallationRepository irepo = new InstallationRepository();
        customer = new Customer();
        customer.customerid = incustomer.customerid;
        customer.firstname = incustomer.firstname;
        customer.lastname = incustomer.lastname;
        customer.username = incustomer.username;
        customer.password = incustomer.password;
        customer.engineerid = incustomer.engineerid;
        customer.email = incustomer.email;
        customer.Engineer = ConvertEngineer.ConverttoEntity(erepo.GetById(customer.engineerid));
        foreach (var item in incustomer.Installation)
        {
            customer.Installation.Add(ConvertInstallation.ConverttoEntity(irepo.GetById(item)));
        }
        log.Info("CustomerModel wurde konvertiert.");
        }
        catch (Exception exp)
        {
        log.Error("CustomerModel konnte nicht konvertiert werden.");
        throw new DalException("CustomerModel konnte nicht konvertiert werden.", exp);
        }
        return customer;
 }
 public static CustomerModel ConvertfromEntity(Customer incustomer)
 {
     CustomerModel customer = null;
        try
        {
        customer = new CustomerModel();
        customer.customerid = incustomer.customerid;
        customer.firstname = incustomer.firstname;
        customer.lastname = incustomer.lastname;
        customer.username = incustomer.username;
        customer.password = incustomer.password;
        customer.engineerid = incustomer.engineerid;
        customer.email = incustomer.email;
        foreach (var item in incustomer.Installation)
        {
            customer.Installation.Add(item.installationid);
        }
        log.Info("Customer wurde konvertiert");
        }
        catch (Exception exp)
        {
        log.Error("Customer konnte nicht konvertiert werden.");
        throw new DalException("Customer konnte nicht konvertiert werden.", exp);
        }
        return customer;
 }