Beispiel #1
0
        public static LinkedInProfileEntity Map(this LinkedInProfile profile)
        {
            var entity = new LinkedInProfileEntity {
                linkedInId = profile.Id, createdTime = profile.CreatedTime
            };

            profile.MapTo(entity);
            return(entity);
        }
Beispiel #2
0
        void ILinkedInRepository.UpdateProfile(LinkedInProfile profile)
        {
            using (var dc = CreateContext())
            {
                var entity = GetProfileEntity(dc, profile.Id);
                if (entity == null)
                {
                    dc.LinkedInProfileEntities.InsertOnSubmit(profile.Map());
                }
                else
                {
                    dc.CheckDeleteLocation(profile, entity);
                    if (entity.LinkedInProfileIndustryEntities != null && entity.LinkedInProfileIndustryEntities.Count > 0)
                    {
                        dc.LinkedInProfileIndustryEntities.DeleteAllOnSubmit(entity.LinkedInProfileIndustryEntities);
                    }
                    profile.MapTo(entity);
                }

                dc.SubmitChanges();
            }
        }