From 7ff8524f57d6f4641e4a3dbea6ff6dbe9e346deb Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Mon, 20 Nov 2017 13:56:18 +0100 Subject: first commit --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b9da6b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# AirPollutionWebApi -- cgit v1.2.3 From 71f272fbc3917dcdd81c2c829bccad9b64eb9128 Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Mon, 20 Nov 2017 13:57:30 +0100 Subject: Create .gitignore --- .gitignore | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..940794e --- /dev/null +++ b/.gitignore @@ -0,0 +1,288 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs -- cgit v1.2.3 From f6f830d066635c91763dd1ae6248c8c189e6fe7e Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Mon, 20 Nov 2017 14:36:20 +0100 Subject: Added WebApi. --- .gitignore | 40 ++++++++ .../AirPollutionWebApi.Tests.csproj | 91 +++++++++++++++++ .../Controllers/HomeControllerTest.cs | 35 +++++++ AirPollutionWebApi.Tests/packages.config | 13 +++ AirPollutionWebApi.sln | 23 +++++ AirPollutionWebApi/AirPollutionWebApi.csproj | 112 +++++++++++++++++++++ AirPollutionWebApi/App_Start/RouteConfig.cs | 19 ++++ AirPollutionWebApi/App_Start/WebApiConfig.cs | 24 +++++ AirPollutionWebApi/Controllers/HomeController.cs | 23 +++++ .../Controllers/ReadingsController.cs | 62 ++++++++++++ AirPollutionWebApi/Global.asax | 1 + AirPollutionWebApi/Global.asax.cs | 17 ++++ AirPollutionWebApi/Models/Reading.cs | 12 +++ AirPollutionWebApi/Singletons/Singleton.cs | 93 +++++++++++++++++ AirPollutionWebApi/Views/Home/Index.cshtml | 1 + AirPollutionWebApi/Views/Shared/Error.cshtml | 5 + AirPollutionWebApi/Views/Shared/_Layout.cshtml | 9 ++ AirPollutionWebApi/Views/Web.config | 30 ++++++ AirPollutionWebApi/Views/_ViewStart.cshtml | 3 + AirPollutionWebApi/Web.config | 16 +++ AirPollutionWebApi/packages.config | 12 +++ 21 files changed, 641 insertions(+) create mode 100755 .gitignore create mode 100644 AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj create mode 100644 AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs create mode 100644 AirPollutionWebApi.Tests/packages.config create mode 100644 AirPollutionWebApi.sln create mode 100644 AirPollutionWebApi/AirPollutionWebApi.csproj create mode 100644 AirPollutionWebApi/App_Start/RouteConfig.cs create mode 100644 AirPollutionWebApi/App_Start/WebApiConfig.cs create mode 100644 AirPollutionWebApi/Controllers/HomeController.cs create mode 100644 AirPollutionWebApi/Controllers/ReadingsController.cs create mode 100644 AirPollutionWebApi/Global.asax create mode 100644 AirPollutionWebApi/Global.asax.cs create mode 100644 AirPollutionWebApi/Models/Reading.cs create mode 100644 AirPollutionWebApi/Singletons/Singleton.cs create mode 100644 AirPollutionWebApi/Views/Home/Index.cshtml create mode 100644 AirPollutionWebApi/Views/Shared/Error.cshtml create mode 100644 AirPollutionWebApi/Views/Shared/_Layout.cshtml create mode 100644 AirPollutionWebApi/Views/Web.config create mode 100644 AirPollutionWebApi/Views/_ViewStart.cshtml create mode 100644 AirPollutionWebApi/Web.config create mode 100644 AirPollutionWebApi/packages.config diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..4e82d27 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# Autosave files +*~ + +# build +[Oo]bj/ +[Bb]in/ +packages/ +TestResults/ + +# globs +Makefile.in +*.DS_Store +*.sln.cache +*.suo +*.cache +*.pidb +*.userprefs +*.usertasks +config.log +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.user +*.tar.gz +tarballs/ +test-results/ +Thumbs.db + +# Mac bundle stuff +*.dmg +*.app + +# resharper +*_Resharper.* +*.Resharper + +# dotCover +*.dotCover diff --git a/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj b/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj new file mode 100644 index 0000000..a3f8082 --- /dev/null +++ b/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj @@ -0,0 +1,91 @@ + + + + Debug + AnyCPU + {803677F8-DC3E-47DA-8E66-BE10F4F47E3A} + Library + AirPollutionWebApi.Tests + AirPollutionWebApi.Tests + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + + + true + bin\Release + prompt + 4 + + + + + + + + + + + + + + + + ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll + + + + + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07} + AirPollutionWebApi + + + + + + + + + + \ No newline at end of file diff --git a/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs b/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs new file mode 100644 index 0000000..fdae606 --- /dev/null +++ b/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web.Mvc; +using AirPollutionWebApi; +using AirPollutionWebApi.Controllers; + +namespace AirPollutionWebApi.Tests.Controllers +{ + [TestFixture] + public class HomeControllerTest + { + [Test] + public void Index() + { + // Arrange + var controller = new HomeController(); + + // Act + var result = (ViewResult)controller.Index(); + + var mvcName = typeof(Controller).Assembly.GetName(); + var isMono = Type.GetType("Mono.Runtime") != null; + + var expectedVersion = mvcName.Version.Major + "." + mvcName.Version.Minor; + var expectedRuntime = isMono ? "Mono" : ".NET"; + + // Assert + Assert.AreEqual(expectedVersion, result.ViewData["Version"]); + Assert.AreEqual(expectedRuntime, result.ViewData["Runtime"]); + } + } +} diff --git a/AirPollutionWebApi.Tests/packages.config b/AirPollutionWebApi.Tests/packages.config new file mode 100644 index 0000000..89948e8 --- /dev/null +++ b/AirPollutionWebApi.Tests/packages.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/AirPollutionWebApi.sln b/AirPollutionWebApi.sln new file mode 100644 index 0000000..360c4e4 --- /dev/null +++ b/AirPollutionWebApi.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirPollutionWebApi", "AirPollutionWebApi\AirPollutionWebApi.csproj", "{22C32F4C-0DEB-40EA-9D56-48942CBB2A07}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirPollutionWebApi.Tests", "AirPollutionWebApi.Tests\AirPollutionWebApi.Tests.csproj", "{803677F8-DC3E-47DA-8E66-BE10F4F47E3A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Release|Any CPU.Build.0 = Release|Any CPU + {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/AirPollutionWebApi/AirPollutionWebApi.csproj b/AirPollutionWebApi/AirPollutionWebApi.csproj new file mode 100644 index 0000000..745c24d --- /dev/null +++ b/AirPollutionWebApi/AirPollutionWebApi.csproj @@ -0,0 +1,112 @@ + + + + Debug + AnyCPU + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07} + {349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + AirPollutionWebApi + AirPollutionWebApi + v4.5 + + + true + full + false + bin + DEBUG; + prompt + 4 + + + true + bin + prompt + 4 + + + + + + + + + + + + + + + + ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + Global.asax + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AirPollutionWebApi/App_Start/RouteConfig.cs b/AirPollutionWebApi/App_Start/RouteConfig.cs new file mode 100644 index 0000000..bc8f39a --- /dev/null +++ b/AirPollutionWebApi/App_Start/RouteConfig.cs @@ -0,0 +1,19 @@ +using System.Web.Mvc; +using System.Web.Routing; + +namespace AirPollutionWebApi +{ + public class RouteConfig + { + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); + } + } +} diff --git a/AirPollutionWebApi/App_Start/WebApiConfig.cs b/AirPollutionWebApi/App_Start/WebApiConfig.cs new file mode 100644 index 0000000..6adb366 --- /dev/null +++ b/AirPollutionWebApi/App_Start/WebApiConfig.cs @@ -0,0 +1,24 @@ +using System.Net.Http.Formatting; +using System.Web.Http; + +namespace AirPollutionWebApi +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + // Web API configuration and services + config.Formatters.Clear(); + config.Formatters.Add(new JsonMediaTypeFormatter()); + + // Web API routes + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } +} diff --git a/AirPollutionWebApi/Controllers/HomeController.cs b/AirPollutionWebApi/Controllers/HomeController.cs new file mode 100644 index 0000000..6a83056 --- /dev/null +++ b/AirPollutionWebApi/Controllers/HomeController.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Mvc.Ajax; + +namespace AirPollutionWebApi.Controllers +{ + public class HomeController : Controller + { + public ActionResult Index() + { + var mvcName = typeof(Controller).Assembly.GetName(); + var isMono = Type.GetType("Mono.Runtime") != null; + + ViewData["Version"] = mvcName.Version.Major + "." + mvcName.Version.Minor; + ViewData["Runtime"] = isMono ? "Mono" : ".NET"; + + return View(); + } + } +} diff --git a/AirPollutionWebApi/Controllers/ReadingsController.cs b/AirPollutionWebApi/Controllers/ReadingsController.cs new file mode 100644 index 0000000..3ffe624 --- /dev/null +++ b/AirPollutionWebApi/Controllers/ReadingsController.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; +using System.Web.Mvc; +using AirPollutionWebApi.Models; +using AirPollutionWebApi.Singletons; + +namespace AirPollutionWebApi.Controllers +{ + public class ReadingsController : ApiController + { + public ReadingsController() { } + + public IEnumerable GetAllReadings() + { + return Singleton.Instance.Readings; + } + + //public IHttpActionResult GetReading(int id) + //{ + // var customer = Singleton.Instance.Readings.FirstOrDefault((p) => p.TimeStamp == id); + + // if (customer != null) return Ok(customer); + // else return NotFound(); + //} + + //public IHttpActionResult PutReading(int id, Reading customer) + //{ + // if (customer != null) + // { + // Singleton.Instance.PutData(id, customer); + // return Ok(); + // } + // else return BadRequest(); + //} + + public IHttpActionResult PostReading(Reading customer) + { + if (customer != null) + { + Singleton.Instance.PostData(customer); + return Ok(); + } + else return BadRequest(); + } + + //public IHttpActionResult DeleteReading(int id) + //{ + // Reading customer = Singleton.Instance.Readings.Find((p) => p.Id == id); + // if (customer == null) + // { + // return NotFound(); + // } + + // Singleton.Instance.DeleteData(id); + + // return Ok(customer); + //} + } +} \ No newline at end of file diff --git a/AirPollutionWebApi/Global.asax b/AirPollutionWebApi/Global.asax new file mode 100644 index 0000000..9fb00cd --- /dev/null +++ b/AirPollutionWebApi/Global.asax @@ -0,0 +1 @@ +<%@ Application Inherits="AirPollutionWebApi.Global" %> diff --git a/AirPollutionWebApi/Global.asax.cs b/AirPollutionWebApi/Global.asax.cs new file mode 100644 index 0000000..aa5b94f --- /dev/null +++ b/AirPollutionWebApi/Global.asax.cs @@ -0,0 +1,17 @@ +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; +using System.Web.Http; + +namespace AirPollutionWebApi +{ + public class Global : HttpApplication + { + protected void Application_Start() + { + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(WebApiConfig.Register); + RouteConfig.RegisterRoutes(RouteTable.Routes); + } + } +} diff --git a/AirPollutionWebApi/Models/Reading.cs b/AirPollutionWebApi/Models/Reading.cs new file mode 100644 index 0000000..b829711 --- /dev/null +++ b/AirPollutionWebApi/Models/Reading.cs @@ -0,0 +1,12 @@ +using System; + +namespace AirPollutionWebApi.Models +{ + public class Reading + { + public DateTime TimeStamp { get; set; } + public int Co { get; set; } + public int No { get; set; } + public int So { get; set; } + } +} diff --git a/AirPollutionWebApi/Singletons/Singleton.cs b/AirPollutionWebApi/Singletons/Singleton.cs new file mode 100644 index 0000000..5da91ad --- /dev/null +++ b/AirPollutionWebApi/Singletons/Singleton.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using AirPollutionWebApi.Models; + +namespace AirPollutionWebApi.Singletons +{ + public class Singleton + { + static Singleton instance; + const string ConnectionString = "Server=tcp:forschool.database.windows.net,1433;Initial Catalog=schooldb;Persist Security Info=False;User ID=***REMOVED***;Password=***REMOVED***;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"; + + public List Readings = new List(); + + Singleton() + { + GetData(); + } + + public static Singleton Instance + { + get + { + if (instance == null) + { + instance = new Singleton(); + } + return instance; + } + } + + void GetData() + { + Readings = new List(); + using (SqlConnection databaseConnection = new SqlConnection(ConnectionString)) + { + string command = "SELECT * FROM Readings"; + databaseConnection.Open(); + SqlCommand selectCommand = new SqlCommand(command, databaseConnection); + var reader = selectCommand.ExecuteReader(); + while (reader.Read()) + { + Readings.Add(new Reading + { + TimeStamp = reader.GetDateTime(0), + Co = reader.GetInt32(1), + No = reader.GetInt32(2), + So = reader.GetInt32(3) + }); + } + } + } + + //public void PutData(int id, Reading reading) + //{ + // using (SqlConnection dbCon = new SqlConnection(ConnectionString)) + // { + // dbCon.Open(); + // string query = $"UPDATE Readings SET FirstName='{reading.FirstName}', LastName='{reading.LastName}', Year='{reading.Year}' WHERE Id={id};"; + // var cmd = new SqlCommand(query, dbCon); + // cmd.ExecuteNonQuery(); + // dbCon.Close(); + // } + // GetData(); + //} + + public void PostData(Reading reading) + { + using (SqlConnection dbCon = new SqlConnection(ConnectionString)) + { + dbCon.Open(); + string query = $"INSERT INTO Readings (TimeStamp,Co,No,So) VALUES('{reading.TimeStamp}',{reading.Co},{reading.No},{reading.So});"; + var cmd = new SqlCommand(query, dbCon); + cmd.ExecuteNonQuery(); + dbCon.Close(); + } + GetData(); + } + + public void DeleteData(int id) + { + using (SqlConnection dbCon = new SqlConnection(ConnectionString)) + { + dbCon.Open(); + string query = $"DELETE FROM Readings WHERE Id={id};"; + var cmd = new SqlCommand(query, dbCon); + cmd.ExecuteNonQuery(); + dbCon.Close(); + } + GetData(); + } + } +} \ No newline at end of file diff --git a/AirPollutionWebApi/Views/Home/Index.cshtml b/AirPollutionWebApi/Views/Home/Index.cshtml new file mode 100644 index 0000000..2501eee --- /dev/null +++ b/AirPollutionWebApi/Views/Home/Index.cshtml @@ -0,0 +1 @@ +

Welcome to ASP.NET MVC @ViewData["Version"] on @ViewData["Runtime"]!

diff --git a/AirPollutionWebApi/Views/Shared/Error.cshtml b/AirPollutionWebApi/Views/Shared/Error.cshtml new file mode 100644 index 0000000..20ec06a --- /dev/null +++ b/AirPollutionWebApi/Views/Shared/Error.cshtml @@ -0,0 +1,5 @@ +@model System.Web.Mvc.HandleErrorInfo + +
+

An error occurred while processing your request.

+
diff --git a/AirPollutionWebApi/Views/Shared/_Layout.cshtml b/AirPollutionWebApi/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..54f6729 --- /dev/null +++ b/AirPollutionWebApi/Views/Shared/_Layout.cshtml @@ -0,0 +1,9 @@ + + + + @ViewBag.Title + + + @RenderBody() + + diff --git a/AirPollutionWebApi/Views/Web.config b/AirPollutionWebApi/Views/Web.config new file mode 100644 index 0000000..c23d873 --- /dev/null +++ b/AirPollutionWebApi/Views/Web.config @@ -0,0 +1,30 @@ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AirPollutionWebApi/Views/_ViewStart.cshtml b/AirPollutionWebApi/Views/_ViewStart.cshtml new file mode 100644 index 0000000..2de6241 --- /dev/null +++ b/AirPollutionWebApi/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} diff --git a/AirPollutionWebApi/Web.config b/AirPollutionWebApi/Web.config new file mode 100644 index 0000000..318bf1c --- /dev/null +++ b/AirPollutionWebApi/Web.config @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/AirPollutionWebApi/packages.config b/AirPollutionWebApi/packages.config new file mode 100644 index 0000000..721eb8b --- /dev/null +++ b/AirPollutionWebApi/packages.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 956d0c668bf20cb461c2c48ce388087bc6618886 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Thu, 23 Nov 2017 10:16:47 +0100 Subject: Changed configs. --- .../AirPollutionWebApi.Tests.csproj | 91 - .../Controllers/HomeControllerTest.cs | 35 - AirPollutionWebApi.Tests/packages.config | 13 - AirPollutionWebApi.sln | 6 - AirPollutionWebApi.userprefs | 8 +- AirPollutionWebApi/AirPollutionWebApi.csproj | 12 +- AirPollutionWebApi/Web.config | 9 + AirPollutionWebApi/bin/AirPollutionWebApi.dll | Bin 11776 -> 11776 bytes AirPollutionWebApi/bin/AirPollutionWebApi.pdb | Bin 2512 -> 2512 bytes AirPollutionWebApi/bin/Newtonsoft.Json.dll | Bin 653824 -> 502272 bytes AirPollutionWebApi/bin/Newtonsoft.Json.xml | 9914 ++++++++------------ .../bin/System.Net.Http.Formatting.dll | Bin 185544 -> 185032 bytes AirPollutionWebApi/bin/System.Web.Http.WebHost.dll | Bin 82120 -> 82120 bytes AirPollutionWebApi/bin/System.Web.Http.dll | Bin 471240 -> 471248 bytes ...rPollutionWebApi.csproj.CoreCompileInputs.cache | 2 +- .../obj/Debug/AirPollutionWebApi.dll | Bin 11776 -> 11776 bytes .../obj/Debug/AirPollutionWebApi.pdb | Bin 2512 -> 2512 bytes AirPollutionWebApi/packages.config | 10 +- AirPollutionWebApi/web.config | 2 + .../Microsoft.AspNet.WebApi.5.2.0.nupkg | Bin 0 -> 3175 bytes .../Microsoft.AspNet.WebApi.Client.5.2.0.nupkg | Bin 0 -> 188658 bytes .../lib/net45/System.Net.Http.Formatting.dll | Bin 0 -> 185032 bytes .../lib/net45/System.Net.Http.Formatting.xml | 2094 +++++ .../System.Net.Http.Formatting.dll | Bin 0 -> 150728 bytes .../System.Net.Http.Formatting.xml | 4025 ++++++++ .../Content/web.config.transform | 11 + .../Microsoft.AspNet.WebApi.Core.5.2.0.nupkg | Bin 0 -> 239362 bytes .../lib/net45/System.Web.Http.dll | Bin 0 -> 471248 bytes .../lib/net45/System.Web.Http.xml | 6664 +++++++++++++ .../Microsoft.AspNet.WebApi.WebHost.5.2.0.nupkg | Bin 0 -> 43002 bytes .../lib/net45/System.Web.Http.WebHost.dll | Bin 0 -> 82120 bytes .../lib/net45/System.Web.Http.WebHost.xml | 135 + .../Newtonsoft.Json.6.0.4.nupkg | Bin 0 -> 1513616 bytes .../lib/net20/Newtonsoft.Json.dll | Bin 0 -> 493056 bytes .../lib/net20/Newtonsoft.Json.xml | 9108 ++++++++++++++++++ .../lib/net35/Newtonsoft.Json.dll | Bin 0 -> 430080 bytes .../lib/net35/Newtonsoft.Json.xml | 8251 ++++++++++++++++ .../lib/net40/Newtonsoft.Json.dll | Bin 0 -> 493056 bytes .../lib/net40/Newtonsoft.Json.xml | 8558 +++++++++++++++++ .../lib/net45/Newtonsoft.Json.dll | Bin 0 -> 502272 bytes .../lib/net45/Newtonsoft.Json.xml | 8558 +++++++++++++++++ .../lib/netcore45/Newtonsoft.Json.dll | Bin 0 -> 446976 bytes .../lib/netcore45/Newtonsoft.Json.xml | 8083 ++++++++++++++++ .../Newtonsoft.Json.dll | Bin 0 -> 387072 bytes .../Newtonsoft.Json.xml | 7711 +++++++++++++++ .../Newtonsoft.Json.dll | Bin 0 -> 444928 bytes .../Newtonsoft.Json.xml | 8083 ++++++++++++++++ packages/Newtonsoft.Json.6.0.4/tools/install.ps1 | 93 + 48 files changed, 75259 insertions(+), 6217 deletions(-) delete mode 100644 AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj delete mode 100644 AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs delete mode 100644 AirPollutionWebApi.Tests/packages.config create mode 100644 AirPollutionWebApi/web.config create mode 100644 packages/Microsoft.AspNet.WebApi.5.2.0/Microsoft.AspNet.WebApi.5.2.0.nupkg create mode 100644 packages/Microsoft.AspNet.WebApi.Client.5.2.0/Microsoft.AspNet.WebApi.Client.5.2.0.nupkg create mode 100644 packages/Microsoft.AspNet.WebApi.Client.5.2.0/lib/net45/System.Net.Http.Formatting.dll create mode 100644 packages/Microsoft.AspNet.WebApi.Client.5.2.0/lib/net45/System.Net.Http.Formatting.xml create mode 100644 packages/Microsoft.AspNet.WebApi.Client.5.2.0/lib/portable-wp8+netcore45+net45+wp81+wpa81/System.Net.Http.Formatting.dll create mode 100644 packages/Microsoft.AspNet.WebApi.Client.5.2.0/lib/portable-wp8+netcore45+net45+wp81+wpa81/System.Net.Http.Formatting.xml create mode 100644 packages/Microsoft.AspNet.WebApi.Core.5.2.0/Content/web.config.transform create mode 100644 packages/Microsoft.AspNet.WebApi.Core.5.2.0/Microsoft.AspNet.WebApi.Core.5.2.0.nupkg create mode 100644 packages/Microsoft.AspNet.WebApi.Core.5.2.0/lib/net45/System.Web.Http.dll create mode 100644 packages/Microsoft.AspNet.WebApi.Core.5.2.0/lib/net45/System.Web.Http.xml create mode 100644 packages/Microsoft.AspNet.WebApi.WebHost.5.2.0/Microsoft.AspNet.WebApi.WebHost.5.2.0.nupkg create mode 100644 packages/Microsoft.AspNet.WebApi.WebHost.5.2.0/lib/net45/System.Web.Http.WebHost.dll create mode 100644 packages/Microsoft.AspNet.WebApi.WebHost.5.2.0/lib/net45/System.Web.Http.WebHost.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/Newtonsoft.Json.6.0.4.nupkg create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net20/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net20/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net35/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net35/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net40/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net40/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net45/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/net45/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/netcore45/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/netcore45/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll create mode 100644 packages/Newtonsoft.Json.6.0.4/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.xml create mode 100644 packages/Newtonsoft.Json.6.0.4/tools/install.ps1 diff --git a/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj b/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj deleted file mode 100644 index a3f8082..0000000 --- a/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - Debug - AnyCPU - {803677F8-DC3E-47DA-8E66-BE10F4F47E3A} - Library - AirPollutionWebApi.Tests - AirPollutionWebApi.Tests - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - true - bin\Release - prompt - 4 - - - - - - - - - - - - - - - - ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - - - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - - - ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll - - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - - - ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll - - - - - {22C32F4C-0DEB-40EA-9D56-48942CBB2A07} - AirPollutionWebApi - - - - - - - - - - \ No newline at end of file diff --git a/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs b/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs deleted file mode 100644 index fdae606..0000000 --- a/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs +++ /dev/null @@ -1,35 +0,0 @@ -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web.Mvc; -using AirPollutionWebApi; -using AirPollutionWebApi.Controllers; - -namespace AirPollutionWebApi.Tests.Controllers -{ - [TestFixture] - public class HomeControllerTest - { - [Test] - public void Index() - { - // Arrange - var controller = new HomeController(); - - // Act - var result = (ViewResult)controller.Index(); - - var mvcName = typeof(Controller).Assembly.GetName(); - var isMono = Type.GetType("Mono.Runtime") != null; - - var expectedVersion = mvcName.Version.Major + "." + mvcName.Version.Minor; - var expectedRuntime = isMono ? "Mono" : ".NET"; - - // Assert - Assert.AreEqual(expectedVersion, result.ViewData["Version"]); - Assert.AreEqual(expectedRuntime, result.ViewData["Runtime"]); - } - } -} diff --git a/AirPollutionWebApi.Tests/packages.config b/AirPollutionWebApi.Tests/packages.config deleted file mode 100644 index 89948e8..0000000 --- a/AirPollutionWebApi.Tests/packages.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/AirPollutionWebApi.sln b/AirPollutionWebApi.sln index 360c4e4..35d9c6a 100644 --- a/AirPollutionWebApi.sln +++ b/AirPollutionWebApi.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirPollutionWebApi", "AirPollutionWebApi\AirPollutionWebApi.csproj", "{22C32F4C-0DEB-40EA-9D56-48942CBB2A07}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirPollutionWebApi.Tests", "AirPollutionWebApi.Tests\AirPollutionWebApi.Tests.csproj", "{803677F8-DC3E-47DA-8E66-BE10F4F47E3A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,9 +13,5 @@ Global {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Debug|Any CPU.Build.0 = Debug|Any CPU {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Release|Any CPU.ActiveCfg = Release|Any CPU {22C32F4C-0DEB-40EA-9D56-48942CBB2A07}.Release|Any CPU.Build.0 = Release|Any CPU - {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {803677F8-DC3E-47DA-8E66-BE10F4F47E3A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/AirPollutionWebApi.userprefs b/AirPollutionWebApi.userprefs index 960b2df..22153ef 100644 --- a/AirPollutionWebApi.userprefs +++ b/AirPollutionWebApi.userprefs @@ -1,6 +1,6 @@  - + @@ -8,7 +8,11 @@ - + + + + + diff --git a/AirPollutionWebApi/AirPollutionWebApi.csproj b/AirPollutionWebApi/AirPollutionWebApi.csproj index 745c24d..ca8c5ac 100644 --- a/AirPollutionWebApi/AirPollutionWebApi.csproj +++ b/AirPollutionWebApi/AirPollutionWebApi.csproj @@ -59,20 +59,20 @@ ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll + + - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.0\lib\net45\System.Net.Http.Formatting.dll - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.0\lib\net45\System.Web.Http.dll - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.0\lib\net45\System.Web.Http.WebHost.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll - diff --git a/AirPollutionWebApi/Web.config b/AirPollutionWebApi/Web.config index 318bf1c..3056996 100644 --- a/AirPollutionWebApi/Web.config +++ b/AirPollutionWebApi/Web.config @@ -12,5 +12,14 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx + + + + + + + + + \ No newline at end of file diff --git a/AirPollutionWebApi/bin/AirPollutionWebApi.dll b/AirPollutionWebApi/bin/AirPollutionWebApi.dll index c5a0c27..8377b26 100644 Binary files a/AirPollutionWebApi/bin/AirPollutionWebApi.dll and b/AirPollutionWebApi/bin/AirPollutionWebApi.dll differ diff --git a/AirPollutionWebApi/bin/AirPollutionWebApi.pdb b/AirPollutionWebApi/bin/AirPollutionWebApi.pdb index 02cf464..fee9f7f 100644 Binary files a/AirPollutionWebApi/bin/AirPollutionWebApi.pdb and b/AirPollutionWebApi/bin/AirPollutionWebApi.pdb differ diff --git a/AirPollutionWebApi/bin/Newtonsoft.Json.dll b/AirPollutionWebApi/bin/Newtonsoft.Json.dll index 77a5d89..597a1ce 100644 Binary files a/AirPollutionWebApi/bin/Newtonsoft.Json.dll and b/AirPollutionWebApi/bin/Newtonsoft.Json.dll differ diff --git a/AirPollutionWebApi/bin/Newtonsoft.Json.xml b/AirPollutionWebApi/bin/Newtonsoft.Json.xml index dd18d3d..b48343e 100644 --- a/AirPollutionWebApi/bin/Newtonsoft.Json.xml +++ b/AirPollutionWebApi/bin/Newtonsoft.Json.xml @@ -9,5473 +9,3925 @@ Represents a BSON Oid (object id). + + + Initializes a new instance of the class. + + The Oid value. + Gets or sets the value of the Oid. The value of the Oid. - + - Initializes a new instance of the class. + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - The Oid value. - + - Represents a reader that provides fast, non-cached, forward-only access to serialized BSON data. + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - + - Gets or sets a value indicating whether binary data reading should be compatible with incorrect Json.NET 3.5 written binary. + Initializes a new instance of the class with the specified . - - true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false. - - + - Gets or sets a value indicating whether the root object will be read as a JSON array. + Reads the next JSON token from the stream. - - true if the root object will be read as a JSON array; otherwise, false. - + true if the next token was read successfully; false if there are no more tokens to read. - + - Gets or sets the used when reading values from BSON. + Reads the next JSON token from the stream as a . - The used when reading values from BSON. + A . This method will return null at the end of an array. - + - Initializes a new instance of the class. + Reads the next JSON token from the stream as a . - The containing the BSON data to read. + A . This method will return null at the end of an array. - + - Initializes a new instance of the class. + Reads the next JSON token from the stream as a . - The containing the BSON data to read. + A or a null reference if the next JSON token is null. This method will return null at the end of an array. - + - Initializes a new instance of the class. + Reads the next JSON token from the stream as a . - The containing the BSON data to read. - if set to true the root object will be read as a JSON array. - The used when reading values from BSON. + A . This method will return null at the end of an array. - + - Initializes a new instance of the class. + Reads the next JSON token from the stream as a . - The containing the BSON data to read. - if set to true the root object will be read as a JSON array. - The used when reading values from BSON. + A . This method will return null at the end of an array. - + - Reads the next JSON token from the underlying . + Reads the next JSON token from