Ejemplo n.º 1
0
        public static EmployeeDto ConvertToDto(Employee m)
        {
            if (m == null)
            {
                return(new EmployeeDto());
            }

            var res = new EmployeeDto
            {
                Id           = m.Id,
                StaffTypeId  = m.StaffTypeId,
                StoreId      = m.StoreId,
                FullName     = m.FullName,
                IdentityCard = m.IdentityCard,
                Nationality  = m.Nationality,
                Address      = m.Address,
                DateOfBirth  = m.DateOfBirth,
                Gender       = m.Gender,
                Phone        = m.Phone,
                Email        = m.Email,
                Nationality1 = NationalDto.ConvertToDto(m.Nationality1),
                StaffType    = StaffTypeDto.ConvertToDto(m.StaffType),
                Store        = StoreDto.ConvertToDto(m.Store),
                //Orders = OrderDto.ConvertToDto(m.Orders),
                //Users = UserDto.ConvertToDto(m.Users)
            };

            return(res);
        }
Ejemplo n.º 2
0
        public static IEnumerable <EmployeeDto> ConvertToDto(IEnumerable <Employee> list)
        {
            if (list == null)
            {
                return(new List <EmployeeDto>());
            }

            var res = from m in list
                      select new EmployeeDto
            {
                Id           = m.Id,
                StaffTypeId  = m.StaffTypeId,
                StoreId      = m.StoreId,
                FullName     = m.FullName,
                IdentityCard = m.IdentityCard,
                Nationality  = m.Nationality,
                Address      = m.Address,
                DateOfBirth  = m.DateOfBirth,
                Gender       = m.Gender,
                Phone        = m.Phone,
                Email        = m.Email,
                StaffType    = StaffTypeDto.ConvertToDto(m.StaffType),
                Nationality1 = NationalDto.ConvertToDto(m.Nationality1),
                Store        = StoreDto.ConvertToDto(m.Store)
            };

            return(res.ToList());
        }