public static UserCondition ToAppModel(ServiceData.Models.UserCondition given, bool includeOwner) { UserCondition cond = new UserCondition { Id = given.Id, Passcode = given.Passcode, StartDate = given.StartDate, Treatment = given.Treatment, Condition = given.Condition, Finished = given.Finished, SkinRegion = SkinRegion.ToAppModel(given.SkinRegion, true), Photos = new List <Photo>() }; if (includeOwner && given.Owner != null) { cond.Owner = User.ToAppModel(given.Owner); } if (given.Photos == null) { return(cond); } List <ServiceData.Models.Photo> photos = given.Photos.ToList(); foreach (ServiceData.Models.Photo p in photos) { cond.Photos.Add(Photo.ToAppModel(p, false)); } return(cond); }
public static BodyPart ToAppModel(ServiceData.Models.BodyPart given, bool includeRegions) { BodyPart bp = new BodyPart { Id = given.Id, Name = given.Name }; if (!includeRegions) { return(bp); } bp.SkinRegions = new List <SkinRegion>(); foreach (ServiceData.Models.SkinRegion region in given.SkinRegions) { bp.SkinRegions.Add(SkinRegion.ToAppModel(region, false)); } return(bp); }