Пример #1
0
        public Person CopyFromPersonDPO(PersonDPO p)
        {
            RoleViewModel vmRole = new RoleViewModel();
            int           roleId = 0;

            foreach (var r in vmRole.ListRole)
            {
                if (r.NameRole == p.Role)
                {
                    roleId = r.Id;
                    break;
                }
            }
            if (roleId != 0)
            {
                this.Id        = p.Id;
                this.RoleId    = roleId;
                this.FirstName = p.FirstName;
                this.LastName  = p.LastName;
                this.Birthday  = p.Birthday;
            }
            return(this);
        }
Пример #2
0
        public PersonDPO CopyFromPerson(Person person)
        {
            PersonDPO     perDPO = new PersonDPO();
            RoleViewModel vmRole = new RoleViewModel();
            string        role   = string.Empty;

            foreach (var r in vmRole.ListRole)
            {
                if (r.Id == person.RoleId)
                {
                    role = r.NameRole;
                    break;
                }
            }
            if (role != string.Empty)
            {
                perDPO.Id        = person.Id;
                perDPO.Role      = role;
                perDPO.FirstName = person.FirstName;
                perDPO.LastName  = person.LastName;
                perDPO.Birthday  = person.Birthday;
            }
            return(perDPO);
        }