Exemplo 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);
        }
Exemplo 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());
        }
Exemplo n.º 3
0
        public static StaffType ConvertToModel(StaffTypeDto m)
        {
            if (m == null)
            {
                return(new StaffType());
            }
            var res = new StaffType
            {
                Id   = m.Id,
                Type = m.Type
                       //Employees = EmployeeDto.ConvertToDto(m.Employees)
            };

            return(res);
        }
Exemplo n.º 4
0
        public static StaffTypeDto ConvertToDto(StaffType m)
        {
            if (m == null)
            {
                return(new StaffTypeDto());
            }
            var res = new StaffTypeDto()
            {
                Id   = m.Id,
                Type = m.Type,
                //Employees = EmployeeDto.ConvertToDto(m.Employees)
            };

            return(res);
        }