示例#1
0
        /// <summary>
        /// get detail of particular user
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public VMProfile GetDetailOfParticularUser(long UserID)
        {
            UserProfileCDM objPro     = IUserProfile.GetDetailOfParticularUser(UserID);
            VMProfile      objProfile = new VMProfile();

            //var tempHobby = objPro.Select(objHb => new VMProfileHobbies()
            //{
            //    UserHobbyID=objHb.UserHobbyID,
            //    HobbyId=objHb.HobbyID
            //}).ToList();
            //var tempHobby = objPro.Where(x => x.UserHobbyID > 0).ToList();
            //var tempAdd = objPro.Where(x => x.AddressID > 0).ToList();
            /**/
            objProfile.UserID       = objPro.UserID;
            objProfile.IsActive     = objPro.IsActive;
            objProfile.UserName     = objPro.UserName;
            objProfile.Email        = objPro.Email;
            objProfile.PhoneNumber  = objPro.PhoneNumber;
            objProfile.Gender       = objPro.Gender;
            objProfile.HavePassport = objPro.HavePassport;
            objProfile.Description  = objPro.Description;
            objProfile.Status       = objPro.Status;
            objProfile.Married      = objPro.Married;
            objProfile.UserHobby    = new List <VMProfileHobbies>();
            //objProfile.UserHobby = objPro[0].Hobbies.Select(obj => new VMProfileHobbies()
            //{
            //    UserHobbyID = obj.UserHobbyID,
            //    HobbyId = obj.HobbyID
            //}).ToList();
            if (objPro.Hobbies != null && objPro.Hobbies.Count > 0)
            {
                objProfile.UserHobby = objPro.Hobbies.Select(obj => new VMProfileHobbies()
                {
                    UserHobbyID = obj.UserHobbyID,
                    HobbyId     = obj.HobbyID
                }).ToList();
            }

            objProfile.UserAddress = new List <VMProfileAddress>();
            //objProfile.UserAddress = objPro[0].UserAddress.Select(obj => new VMProfileAddress()
            if (objPro.UserAddress != null && objPro.UserAddress.Count > 0)
            {
                objProfile.UserAddress = objPro.UserAddress.Select(obj => new VMProfileAddress()
                {
                    AddressID   = obj.AddressID,
                    AddressType = obj.AddressType,
                    Address     = obj.Address,
                    AreaCode    = obj.AreaCode,
                    CityID      = obj.CityID,
                    StateID     = obj.SateID,
                    CountryId   = obj.CountryID,
                    CountryName = obj.Country,
                    SateName    = obj.State,
                    CityName    = obj.City
                }).ToList();
            }
            /**/
            return(objProfile);
        }