public static SiteVisit Create(Imports.Site importedSite) { importedSite.Trip.AssertIsImported(); var visit = new SiteVisit { ImportingTrip = importedSite.Trip, Visited = importedSite.Trip.Date.Value, Name = importedSite.Name, State = importedSite.State, County = importedSite.County, OwnershipType = importedSite.OwnershipType, Coordinates = importedSite.Coordinates, CalculatedCoordinates = importedSite.CalculateCoordinates(), OwnershipContactInfo = importedSite.OwnershipContactInfo, MakeOwnershipContactInfoPublic = importedSite.MakeOwnershipContactInfoPublic, Comments = importedSite.Comments, Photos = new List <IPhoto>(), Visitors = new List <Name>(importedSite.Trip.Measurers), TripReportUrl = importedSite.Trip.Website }; visit.Photos.AddRange(from photo in importedSite.Photos select new SiteVisitPhotoReference(photo.ToPhoto(), visit)); return(visit); }
public static Site Create(Imports.Site importedSite) { importedSite.Trip.AssertIsImported(); var site = new Site { Trees = new List <Tree>(), Visits = new List <SiteVisit>(), Name = importedSite.Name, State = importedSite.State, County = importedSite.County, Photos = new List <IPhoto>(), Visitors = new List <Name>() }; site.AddVisit(SiteVisit.Create(importedSite)); foreach (var tree in importedSite.Trees.Select(importedTree => Tree.Create(importedTree))) { site.AddTree(tree); } return(site.RecalculateProperties()); }