Example #1
0
        public static ServiceData.Models.UserCondition ToServiceModel(UserCondition given, bool includeOwner)
        {
            ServiceData.Models.UserCondition cond = new ServiceData.Models.UserCondition
            {
                Id         = given.Id,
                Passcode   = given.Passcode,
                StartDate  = given.StartDate,
                Treatment  = given.Treatment,
                Condition  = given.Condition,
                Finished   = given.Finished,
                SkinRegion = SkinRegion.ToServiceModel(given.SkinRegion, true)
            };

            if (includeOwner && given.Owner != null)
            {
                cond.Owner = User.ToServiceModel(given.Owner);
            }

            if (given.Photos != null)
            {
                List <ServiceData.Models.Photo> photos = new List <ServiceData.Models.Photo>();

                foreach (Photo p in given.Photos)
                {
                    photos.Add(Photo.ToServiceModel(p, false));
                }
                cond.Photos = photos;
            }

            return(cond);
        }
Example #2
0
        public static ServiceData.Models.BodyPart ToServiceModel(BodyPart given, bool includeRegions)
        {
            ServiceData.Models.BodyPart bp = new ServiceData.Models.BodyPart
            {
                Id   = given.Id,
                Name = given.Name
            };

            if (!includeRegions)
            {
                return(bp);
            }

            List <ServiceData.Models.SkinRegion> regions = new List <ServiceData.Models.SkinRegion>();

            foreach (SkinRegion region in given.SkinRegions)
            {
                regions.Add(SkinRegion.ToServiceModel(region, false));
            }
            bp.SkinRegions = regions;

            return(bp);
        }