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);
        }
Exemple #2
0
        public static Engineer ConverttoEntity(EngineerModel inengineer)
        {
            Engineer engineer = null;

            try
            {
                EngineerRepository erepo = new EngineerRepository();
                engineer            = new Engineer();
                engineer.firstname  = inengineer.firstname;
                engineer.lastname   = inengineer.lastname;
                engineer.username   = inengineer.username;
                engineer.password   = inengineer.password;
                engineer.engineerid = inengineer.engineerid;
                engineer.email      = inengineer.email;
                log.Info("EngineerModel wurde konvertiert.");
            }
            catch (Exception exp)
            {
                log.Error("EngineerModel konnte nicht konvertiert werden.");
                throw new DalException("EngineerModel konnte nicht konvertiert werden.", exp);
            }
            return(engineer);
        }