Exemple #1
0
        public static DataContract.PagedList <DataContract.Employee> ToDataContract(this Model.PagedList <Model.Employee> employeeList)
        {
            if (employeeList == null)
            {
                return(null);
            }
            var pagedList = new DataContract.PagedList <DataContract.Employee>();

            pagedList.PageNumber   = employeeList.PageNumber;
            pagedList.PageSize     = employeeList.PageSize;
            pagedList.TotalRecords = employeeList.TotalRecords;
            pagedList.Results      = new List <DataContract.Employee>();
            employeeList.ForEach(employee =>
            {
                pagedList.Results.Add(new DataContract.Employee()
                {
                    Id          = employee.Id,
                    Title       = employee.Title,
                    FirstName   = employee.FirstName,
                    LastName    = employee.LastName,
                    Email       = employee.Email,
                    JoiningDate = employee.JoiningDate,
                    Phone       = employee.Phone,
                    Roles       = employee.Roles
                });
            });
            return(pagedList);
        }
        public static DataContract.PagedList <DataContract.Remark> ToDataContract(this Model.PagedList <Model.Remark> remarkList)
        {
            if (remarkList == null)
            {
                return(null);
            }
            var pagedList = new DataContract.PagedList <DataContract.Remark>();

            pagedList.PageNumber   = remarkList.PageNumber;
            pagedList.PageSize     = remarkList.PageSize;
            pagedList.TotalRecords = remarkList.TotalRecords;
            pagedList.Results      = new List <DataContract.Remark>();
            remarkList.ForEach(remark =>
            {
                pagedList.Results.Add(new DataContract.Remark()
                {
                    Text            = remark.Text,
                    CreateTimeStamp = remark.CreateTimeStamp
                });
            });
            return(pagedList);
        }