mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
185 lines
5.5 KiB
HTML
185 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Welcome to ASP.NET Core Web API REST Service</title>
|
|
<style>
|
|
html {
|
|
background: #f1f1f1;
|
|
height: 100%;
|
|
}
|
|
|
|
body {
|
|
background: #fff;
|
|
color: #505050;
|
|
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
|
|
margin: 1%;
|
|
min-height: 95.5%;
|
|
border: 1px solid silver;
|
|
position: relative;
|
|
}
|
|
|
|
#header {
|
|
padding: 0;
|
|
}
|
|
|
|
#header h1 {
|
|
font-size: 44px;
|
|
font-weight: normal;
|
|
margin: 0;
|
|
padding: 10px 30px 10px 30px;
|
|
}
|
|
|
|
#header span {
|
|
margin: 0;
|
|
padding: 0 30px;
|
|
display: block;
|
|
}
|
|
|
|
#header p {
|
|
font-size: 20px;
|
|
color: #fff;
|
|
background: #007acc;
|
|
padding: 0 30px;
|
|
line-height: 50px;
|
|
margin-top: 25px;
|
|
|
|
}
|
|
|
|
#header p a {
|
|
color: #fff;
|
|
text-decoration: underline;
|
|
font-weight: bold;
|
|
padding-right: 35px;
|
|
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
|
|
}
|
|
|
|
#main {
|
|
padding: 5px 30px;
|
|
clear: both;
|
|
}
|
|
|
|
.section {
|
|
width: 21.7%;
|
|
float: left;
|
|
margin: 0 0 0 4%;
|
|
}
|
|
|
|
.section h2 {
|
|
font-size: 13px;
|
|
text-transform: uppercase;
|
|
margin: 0;
|
|
border-bottom: 1px solid silver;
|
|
padding-bottom: 12px;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.section.first {
|
|
margin-left: 0;
|
|
}
|
|
|
|
.section.first h2 {
|
|
font-size: 24px;
|
|
text-transform: none;
|
|
margin-bottom: 25px;
|
|
border: none;
|
|
}
|
|
|
|
.section.first li {
|
|
border-top: 1px solid silver;
|
|
padding: 8px 0;
|
|
}
|
|
|
|
.section.last {
|
|
margin-right: 0;
|
|
}
|
|
|
|
ul {
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
line-height: 20px;
|
|
}
|
|
|
|
li {
|
|
padding: 4px 0;
|
|
}
|
|
|
|
a {
|
|
color: #267cb2;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
#footer {
|
|
clear: both;
|
|
padding-top: 50px;
|
|
}
|
|
|
|
#footer p {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="header">
|
|
<h1>Welcome to ASP.NET Core REST API Project</h1>
|
|
<span>
|
|
In this example you can see how to easily create REST API with CRUD operations using ASP.NET Core Framework and
|
|
built-in JSON functionalities in SQL Server 2016 and Azure SQL Database.
|
|
</span>
|
|
<p>You can find detailed explanation in <a href="http://www.codeproject.com/Articles/1106622/Building-REST-services-with-ASP-NET-Core-Web-API-a">Code Project</a> article.</p>
|
|
</div>
|
|
|
|
<div id="main">
|
|
<div class="section first">
|
|
<h2>This application consists of:</h2>
|
|
<ul>
|
|
<li>Simple database with one Todo table.</li>
|
|
<li>Simple Controller that implements CRUD operations on Todo table.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section">
|
|
<h2>Setup and configure</h2>
|
|
<ul>
|
|
<li>Create new database on SQL Server 2016 or Azure SQL.</li>
|
|
<li>If you are using Azure SQL make sure that firewall rules in Azure enable you to make connections between your host and Azure SQL database.</li>
|
|
<li>Execute setup.sql script to create Todo table and populate it with sample data.</li>
|
|
<li>Open .xproj file in Visual Studio 2015 and set connection string in Startup.cs file:
|
|
<code>
|
|
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
|
|
const string ConnString = "Server=SERVERNAME.database.windows.net;Database=DATABASENAME;User Id=USERNAME;Password=PASSWORD";
|
|
|
|
</code>
|
|
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="section last">
|
|
<h2>Run</h2>
|
|
<ul>
|
|
<li>Run the project and see results returned from /api/Todo URL.</li>
|
|
<li>Open /api/Todo/1 URL to try GET method that returns single Todo item.</li>
|
|
<li>Use some tool that send POST, PUT, PATCH, or DELETE requests to web server (e.g. Chrome Poster) to try other methods.</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="footer">
|
|
<p>We would love to hear your feedback</p>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|