aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'AirPollutionWebApi')
-rw-r--r--AirPollutionWebApi/.gitignore288
-rw-r--r--AirPollutionWebApi/App_Start/RouteConfig.cs19
-rw-r--r--AirPollutionWebApi/App_Start/WebApiConfig.cs24
-rw-r--r--AirPollutionWebApi/Controllers/HomeController.cs23
-rw-r--r--AirPollutionWebApi/Controllers/ReadingsController.cs88
-rw-r--r--AirPollutionWebApi/Global.asax1
-rw-r--r--AirPollutionWebApi/Global.asax.cs17
-rw-r--r--AirPollutionWebApi/Models/Reading.cs11
-rw-r--r--AirPollutionWebApi/PollutometerWebApi.csproj113
-rw-r--r--AirPollutionWebApi/SqlOperator.cs84
-rw-r--r--AirPollutionWebApi/Views/Home/Index.cshtml1
-rw-r--r--AirPollutionWebApi/Views/Shared/Error.cshtml5
-rw-r--r--AirPollutionWebApi/Views/Shared/_Layout.cshtml9
-rw-r--r--AirPollutionWebApi/Views/Web.config30
-rw-r--r--AirPollutionWebApi/Views/_ViewStart.cshtml3
-rw-r--r--AirPollutionWebApi/Web.config25
-rw-r--r--AirPollutionWebApi/packages.config12
17 files changed, 0 insertions, 753 deletions
diff --git a/AirPollutionWebApi/.gitignore b/AirPollutionWebApi/.gitignore
deleted file mode 100644
index 940794e..0000000
--- a/AirPollutionWebApi/.gitignore
+++ /dev/null
@@ -1,288 +0,0 @@
-## 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
diff --git a/AirPollutionWebApi/App_Start/RouteConfig.cs b/AirPollutionWebApi/App_Start/RouteConfig.cs
deleted file mode 100644
index bc8f39a..0000000
--- a/AirPollutionWebApi/App_Start/RouteConfig.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-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
deleted file mode 100644
index 6adb366..0000000
--- a/AirPollutionWebApi/App_Start/WebApiConfig.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-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
deleted file mode 100644
index 6a83056..0000000
--- a/AirPollutionWebApi/Controllers/HomeController.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-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
deleted file mode 100644
index 99965e6..0000000
--- a/AirPollutionWebApi/Controllers/ReadingsController.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System;
-using System.Web.Http;
-using AirPollutionWebApi.Models;
-using AirPollutionWebApi.Singletons;
-
-namespace AirPollutionWebApi.Controllers
-{
- public class ReadingsController : ApiController
- {
- public ReadingsController() { }
-
- public IHttpActionResult GetAllReadings()
- {
- var command = "SELECT * FROM Readings";
- var readings = SqlOperator.GetReadings(command);
-
- if (readings.Count > 0) return Ok(readings);
- else return NotFound();
- }
-
- public IHttpActionResult GetReading(int id)
- {
- var command = $"SELECT * FROM Readings WHERE Id={id}";
- var reading = SqlOperator.GetReadings(command)[0];
-
- if (reading != null) return Ok(reading);
- else return NotFound();
- }
-
- [Route("api/Readings/latest")]
- public IHttpActionResult GetLatestReading()
- {
- var command = "SELECT * FROM Readings " +
- "WHERE TimeStamp IN(SELECT MAX(TimeStamp) FROM Readings)";
- var reading = SqlOperator.GetReadings(command)[0];
-
- if (reading != null) return Ok(reading);
- else return NotFound();
- }
-
- [Route("api/Readings/lastweek")]
- public IHttpActionResult GetReadingsFromLastWeek()
- {
- var timeNow = DateTimeOffset.Now.ToUnixTimeSeconds();
- var command = "SELECT * FROM Readings " +
- $"WHERE TimeStamp BETWEEN {timeNow-7*24*3600} AND {timeNow}";
- var readings = SqlOperator.GetReadings(command);
-
- if (readings.Count > 0) return Ok(readings);
- else return NotFound();
- }
-
- public IHttpActionResult PutReading(int id, Reading reading)
- {
- if (reading != null)
- {
- SqlOperator.PutReading(id, reading);
- return Ok();
- }
- else return BadRequest();
- }
-
- public IHttpActionResult PostReading(Reading reading)
- {
- if (reading != null)
- {
- SqlOperator.PostReading(reading);
- return Ok();
- }
- else return BadRequest();
- }
-
- public IHttpActionResult DeleteReading(int id)
- {
- var command = $"SELECT * FROM Readings WHERE Id={id}";
-
- Reading reading = SqlOperator.GetReadings(command)[0];
- if (reading == null)
- {
- return NotFound();
- }
-
- SqlOperator.DeleteReading(id);
-
- return Ok(reading);
- }
- }
-} \ No newline at end of file
diff --git a/AirPollutionWebApi/Global.asax b/AirPollutionWebApi/Global.asax
deleted file mode 100644
index 9fb00cd..0000000
--- a/AirPollutionWebApi/Global.asax
+++ /dev/null
@@ -1 +0,0 @@
-<%@ Application Inherits="AirPollutionWebApi.Global" %>
diff --git a/AirPollutionWebApi/Global.asax.cs b/AirPollutionWebApi/Global.asax.cs
deleted file mode 100644
index aa5b94f..0000000
--- a/AirPollutionWebApi/Global.asax.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index 0d7ff39..0000000
--- a/AirPollutionWebApi/Models/Reading.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace AirPollutionWebApi.Models
-{
- public class Reading
- {
- public int Id { get; set; }
- public int TimeStamp { get; set; }
- public double Co { get; set; }
- public double No { get; set; }
- public double So { get; set; }
- }
-}
diff --git a/AirPollutionWebApi/PollutometerWebApi.csproj b/AirPollutionWebApi/PollutometerWebApi.csproj
deleted file mode 100644
index 1fc9e17..0000000
--- a/AirPollutionWebApi/PollutometerWebApi.csproj
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{22C32F4C-0DEB-40EA-9D56-48942CBB2A07}</ProjectGuid>
- <ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <RootNamespace>AirPollutionWebApi</RootNamespace>
- <AssemblyName>AirPollutionWebApi</AssemblyName>
- <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin</OutputPath>
- <DefineConstants>DEBUG;</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <Optimize>true</Optimize>
- <OutputPath>bin</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Web" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Core" />
- <Reference Include="System.Web.Services" />
- <Reference Include="System.Web.Routing" />
- <Reference Include="System.Web.Extensions" />
- <Reference Include="System.Web.Abstractions" />
- <Reference Include="System.Web.DynamicData" />
- <Reference Include="System.ComponentModel.DataAnnotations" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Web.Razor">
- <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.Web.Infrastructure">
- <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Helpers">
- <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.WebPages.Deployment">
- <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.WebPages">
- <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.WebPages.Razor">
- <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Mvc">
- <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
- </Reference>
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Data" />
- <Reference Include="System.Net.Http.Formatting">
- <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Http">
- <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.0\lib\net45\System.Web.Http.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Http.WebHost">
- <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.0\lib\net45\System.Web.Http.WebHost.dll</HintPath>
- </Reference>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Content\" />
- <Folder Include="Models\" />
- <Folder Include="Scripts\" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Controllers\HomeController.cs" />
- <Compile Include="Global.asax.cs">
- <DependentUpon>Global.asax</DependentUpon>
- </Compile>
- <Compile Include="App_Start\WebApiConfig.cs" />
- <Compile Include="App_Start\RouteConfig.cs" />
- <Compile Include="Controllers\ReadingsController.cs" />
- <Compile Include="Models\Reading.cs" />
- <Compile Include="SqlOperator.cs" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="Views\Web.config" />
- <Content Include="Views\Home\Index.cshtml" />
- <Content Include="Views\Shared\_Layout.cshtml" />
- <Content Include="Views\Shared\Error.cshtml" />
- <Content Include="Views\_ViewStart.cshtml" />
- <Content Include="Web.config" />
- <Content Include="Global.asax" />
- <Content Include="packages.config" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' !=''" />
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" Condition="true" />
- <ProjectExtensions>
- <MonoDevelop>
- <Properties>
- <XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
- </Properties>
- </MonoDevelop>
- </ProjectExtensions>
-</Project>
diff --git a/AirPollutionWebApi/SqlOperator.cs b/AirPollutionWebApi/SqlOperator.cs
deleted file mode 100644
index 34213df..0000000
--- a/AirPollutionWebApi/SqlOperator.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data.SqlClient;
-using AirPollutionWebApi.Models;
-
-namespace AirPollutionWebApi.Singletons
-{
- public static class SqlOperator
- {
- 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 static List<Reading> GetReadings(string command)
- {
- var readings = new List<Reading>();
-
- using (SqlConnection databaseConnection = new SqlConnection(ConnectionString))
- {
- databaseConnection.Open();
- SqlCommand selectCommand = new SqlCommand(command, databaseConnection);
- var reader = selectCommand.ExecuteReader();
- while (reader.Read())
- {
- readings.Add(new Reading
- {
- Id = reader.GetInt32(0),
- TimeStamp = reader.GetInt32(1),
- Co = reader.GetDouble(2),
- No = reader.GetDouble(3),
- So = reader.GetDouble(4)
- });
- }
- }
-
- return readings;
- }
-
- public static void PutReading(int id, Reading reading)
- {
- using (SqlConnection dbCon = new SqlConnection(ConnectionString))
- {
- dbCon.Open();
- string query = $"UPDATE Readings SET TimeStamp='{reading.TimeStamp}'," +
- $"Co='{reading.Co}', No='{reading.No}', So='{reading.So}' WHERE Id={id};";
- var cmd = new SqlCommand(query, dbCon);
- cmd.ExecuteNonQuery();
- dbCon.Close();
- }
- }
-
- public static void PostReading(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();
- }
- }
-
- public static void DeleteReading(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();
- }
- }
- }
-} \ No newline at end of file
diff --git a/AirPollutionWebApi/Views/Home/Index.cshtml b/AirPollutionWebApi/Views/Home/Index.cshtml
deleted file mode 100644
index 2501eee..0000000
--- a/AirPollutionWebApi/Views/Home/Index.cshtml
+++ /dev/null
@@ -1 +0,0 @@
-<h2>Welcome to ASP.NET MVC @ViewData["Version"] on @ViewData["Runtime"]!</h2>
diff --git a/AirPollutionWebApi/Views/Shared/Error.cshtml b/AirPollutionWebApi/Views/Shared/Error.cshtml
deleted file mode 100644
index 20ec06a..0000000
--- a/AirPollutionWebApi/Views/Shared/Error.cshtml
+++ /dev/null
@@ -1,5 +0,0 @@
-@model System.Web.Mvc.HandleErrorInfo
-
-<div>
- <h2>An error occurred while processing your request.</h2>
-</div>
diff --git a/AirPollutionWebApi/Views/Shared/_Layout.cshtml b/AirPollutionWebApi/Views/Shared/_Layout.cshtml
deleted file mode 100644
index 54f6729..0000000
--- a/AirPollutionWebApi/Views/Shared/_Layout.cshtml
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>@ViewBag.Title</title>
-</head>
-<body>
- @RenderBody()
-</body>
-</html>
diff --git a/AirPollutionWebApi/Views/Web.config b/AirPollutionWebApi/Views/Web.config
deleted file mode 100644
index c23d873..0000000
--- a/AirPollutionWebApi/Views/Web.config
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
- <configSections>
- <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
- <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
- <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
- </sectionGroup>
- </configSections>
- <system.web.webPages.razor>
- <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
- <pages pageBaseType="System.Web.Mvc.WebViewPage">
- <namespaces>
- <add namespace="System.Web.Mvc" />
- <add namespace="System.Web.Mvc.Ajax" />
- <add namespace="System.Web.Mvc.Html" />
- <add namespace="System.Web.Routing" />
- <add namespace="AirPollutionWebApi" />
- </namespaces>
- </pages>
- </system.web.webPages.razor>
- <appSettings>
- <add key="webpages:Enabled" value="false" />
- </appSettings>
- <system.webServer>
- <handlers>
- <remove name="BlockViewHandler" />
- <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
- </handlers>
- </system.webServer>
-</configuration>
diff --git a/AirPollutionWebApi/Views/_ViewStart.cshtml b/AirPollutionWebApi/Views/_ViewStart.cshtml
deleted file mode 100644
index 2de6241..0000000
--- a/AirPollutionWebApi/Views/_ViewStart.cshtml
+++ /dev/null
@@ -1,3 +0,0 @@
-@{
- Layout = "~/Views/Shared/_Layout.cshtml";
-}
diff --git a/AirPollutionWebApi/Web.config b/AirPollutionWebApi/Web.config
deleted file mode 100644
index 3056996..0000000
--- a/AirPollutionWebApi/Web.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Web.config file for AirPollutionWebApi.
-
-The settings that can be used in this file are documented at
-http://www.mono-project.com/Config_system.web and
-http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
--->
-<configuration>
- <system.web>
- <compilation debug="true" targetFramework="4.5">
- <assemblies />
- </compilation>
- <httpRuntime targetFramework="4.5" />
- <customErrors mode="Off" />
- </system.web>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="6.0.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
-</configuration> \ No newline at end of file
diff --git a/AirPollutionWebApi/packages.config b/AirPollutionWebApi/packages.config
deleted file mode 100644
index 8631ca7..0000000
--- a/AirPollutionWebApi/packages.config
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
- <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebApi" version="5.2.0" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebApi.Client" version="5.2.0" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebApi.Core" version="5.2.0" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.0" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
- <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
- <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
-</packages> \ No newline at end of file