Пример #1
0
        public OkObjectResult Delete([FromBody] List <SiteModel.PiscesSite> input)
        {
            var siteProcessor = new DataAccessLayer.SiteRepository();
            var rval          = siteProcessor.DeleteSites(input);

            return(Ok(rval));
        }
Пример #2
0
        public void SiteDatatypeEndPointQuery()
        {
            var sitedatatypeProcessor = new DataAccessLayer.SiteDataTypeRepository();
            var result = sitedatatypeProcessor.GetSiteDataTypes(conx, new string[] { "1930" }, new string[] { }, new string[] { });

            var siteProcessor = new DataAccessLayer.SiteRepository();
            var resultSite    = siteProcessor.GetSites(conx, new string[] { "921" });

            var datatypeProcessor = new DataAccessLayer.DataTypeRepository();
            var resultDatatype    = datatypeProcessor.GetDataTypes(conx, new string[] { "49" });

            if (result[0].datatype_id == "49" &&
                result[0].site_id == "921" &&
                result[0].site_datatype_id == "1930" &&
                result[0].metadata.site_metadata.site_id == resultSite[0].site_id &&
                result[0].metadata.site_metadata.state_id == resultSite[0].state_id &&
                result[0].metadata.site_metadata.objecttype_id == resultSite[0].objecttype_id &&
                result[0].metadata.datatype_metadata.datatype_id == resultDatatype[0].datatype_id &&
                result[0].metadata.datatype_metadata.unit_id == resultDatatype[0].unit_id)
            {
                Assert.AreEqual(1, 1);
            }
            else
            {
                Assert.AreEqual(0, 1);
            }
        }
Пример #3
0
        public OkObjectResult Get(string siteid = "")
        {
            if (Regex.IsMatch(siteid, "[^A-Za-z_0-9]"))
            {
                throw new Exception("invalid site");
            }

            var siteProcessor = new DataAccessLayer.SiteRepository();

            return(Ok(siteProcessor.GetSites(siteid, siteid != "")));
        }
Пример #4
0
        public void SiteEndPointQuery()
        {
            var siteProcessor = new DataAccessLayer.SiteRepository();
            var result        = siteProcessor.GetSites(conx, new string[] { "921" });

            if (result[0].site_common_name.ToLower() == "hdmlc" &&
                result[0].site_name.ToLower() == "lake mead" &&
                result[0].site_id == "921" &&
                result[0].state_code.ToLower() == "nv" &&
                result[0].objecttype_name.ToLower() == "reservoir" &&
                result[0].db_site_code.ToLower() == "lc")
            {
                Assert.AreEqual(1, 1);
            }
            else
            {
                Assert.AreEqual(0, 1);
            }
        }