public ProfileTelephoneModel MapPDViewModel(IDataReader reader, int index) { ProfileTelephoneModel model = new ProfileTelephoneModel { UserId = reader.GetSafeInt32(index++), Email = reader.GetSafeString(index++), UserName = reader.GetSafeString(index++), FirstName = reader.GetSafeString(index++), MiddleInitial = reader.GetSafeString(index++), LastName = reader.GetSafeString(index++), Gender = reader.GetSafeString(index++), Bio = reader.GetSafeString(index++), Title = reader.GetSafeString(index++), BasePath = reader.GetSafeString(index++), SystemFileName = reader.GetSafeString(index++), PhoneId = reader.GetSafeInt32(index++), PhoneNumber = reader.GetSafeString(index++), PhoneExtension = reader.GetSafeString(index++), PhoneType = reader.GetSafeInt32(index++), DisplayName = reader.GetSafeString(index++), BaseUrl = BaseUrl, ImageId = reader.GetSafeInt32(index++) }; return(model); }
public ProfileDataViewModel GetById(int Id) { ProfileTelephoneModel model = new ProfileTelephoneModel(); List <ProfileTelephoneModel> myList = new List <ProfileTelephoneModel>(); _dataProvider.ExecuteCmd( "ProfileData_GetById", inputParamMapper : delegate(SqlParameterCollection parmList) { parmList.AddWithValue("@Id", Id); }, singleRecordMapper : delegate(IDataReader reader, short set) { int index = 0; model = MapPDViewModel(reader, index); myList.Add(model); }); ProfileDataViewModel profile = new ProfileDataViewModel(); foreach (var ptm in myList) { profile.UserId = ptm.UserId; profile.Email = ptm.Email; profile.UserName = ptm.UserName; profile.FirstName = ptm.FirstName; profile.MiddleInitial = ptm.MiddleInitial; profile.LastName = ptm.LastName; profile.Gender = ptm.Gender; profile.Bio = ptm.Bio; profile.Title = ptm.Title; profile.BasePath = ptm.BasePath; profile.SystemFileName = ptm.SystemFileName; profile.BaseUrl = BaseUrl; profile.ImageId = ptm.ImageId; TelephoneDomainModel telephone = new TelephoneDomainModel(); telephone.Id = ptm.PhoneId; telephone.PhoneNumber = ptm.PhoneNumber; telephone.Extension = ptm.PhoneExtension; telephone.PhoneType = ptm.PhoneType; telephone.DisplayName = ptm.DisplayName; profile.Telephones.Add(telephone); } return(profile); }