예제 #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);
        }
예제 #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());
        }
예제 #3
0
        public static Store ConvertToModel(StoreDto m)
        {
            if (m == null)
            {
                return(new Store());
            }

            var res = new Store
            {
                Id          = m.Id,
                Nationality = m.Nationality,
                Address     = m.Address,
                //Nationality1 = NationalDto.ConvertToDto(m.Nationality1),
                //Employees = EmployeeDto.ConvertToDto(m.Employees)
            };

            return(res);
        }