/// <summary> /// Save or Update site data /// </summary> /// <param name="site">site that need to update or insert</param> /// <returns></returns> public Site SaveOrUpdateSite(Site site) { var domainBuildResult = DomainBuilderFactory.Create(site.GetType()).Build(site, _dbContext); _dbContext.Entry(domainBuildResult.Data).State = domainBuildResult.State; _dbContext.SaveChanges(); var castedDomain = (Hatfield.EnviroData.Core.Site)domainBuildResult.Data; site.Id = castedDomain.SamplingFeatureID; return(site); }
public static void DefaultSetUp() { DomainBuilderFactory.Register(typeof(Site), () => new SiteDomainBuilder()); DomainBuilderFactory.Register(typeof(LabReportSample), () => new WaterQualityObservationBuilder()); }