Skip to content

Commit 21b4657

Browse files
committed
Aggiungere i file di progetto.
1 parent 5e717f3 commit 21b4657

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+21487
-0
lines changed

jQuerySpa.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27703.2018
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jQuerySpa", "jQuerySpa\jQuerySpa.csproj", "{D26D436B-4E49-4991-9123-2B5D333ABC04}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D26D436B-4E49-4991-9123-2B5D333ABC04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D26D436B-4E49-4991-9123-2B5D333ABC04}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D26D436B-4E49-4991-9123-2B5D333ABC04}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D26D436B-4E49-4991-9123-2B5D333ABC04}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {990A15E8-9F71-4B1D-8F7C-F40BDCA18805}
24+
EndGlobalSection
25+
EndGlobal
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Mvc;
7+
using jQuerySpa.Models;
8+
9+
namespace jQuerySpa.Controllers
10+
{
11+
public class HomeController : Controller
12+
{
13+
public IActionResult Index()
14+
{
15+
return View();
16+
}
17+
18+
[HttpPost]
19+
public ActionResult Index(string postText)
20+
{
21+
return RedirectToAction("Table", "Home", new { postText });
22+
}
23+
24+
public ActionResult Table(string getText, string postText, string mySubmit)
25+
{
26+
ViewBag.Message = "Renders dataTable";
27+
28+
return View();
29+
}
30+
31+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
32+
public IActionResult Error()
33+
{
34+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35+
}
36+
}
37+
}

jQuerySpa/Models/ErrorViewModel.cs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace jQuerySpa.Models
4+
{
5+
public class ErrorViewModel
6+
{
7+
public string RequestId { get; set; }
8+
9+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10+
}
11+
}

jQuerySpa/Program.cs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore;
7+
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.Extensions.Configuration;
9+
using Microsoft.Extensions.Logging;
10+
11+
namespace jQuerySpa
12+
{
13+
public class Program
14+
{
15+
public static void Main(string[] args)
16+
{
17+
CreateWebHostBuilder(args).Build().Run();
18+
}
19+
20+
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21+
WebHost.CreateDefaultBuilder(args)
22+
.UseStartup<Startup>();
23+
}
24+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:58922",
7+
"sslPort": 0
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"jQuerySpa": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"applicationUrl": "http://localhost:5000",
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
}
25+
}
26+
}
27+
}

jQuerySpa/Startup.cs

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.AspNetCore.Http;
8+
using Microsoft.AspNetCore.Mvc;
9+
using Microsoft.Extensions.Configuration;
10+
using Microsoft.Extensions.DependencyInjection;
11+
12+
namespace jQuerySpa
13+
{
14+
public class Startup
15+
{
16+
public Startup(IConfiguration configuration)
17+
{
18+
Configuration = configuration;
19+
}
20+
21+
public IConfiguration Configuration { get; }
22+
23+
// This method gets called by the runtime. Use this method to add services to the container.
24+
public void ConfigureServices(IServiceCollection services)
25+
{
26+
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
27+
}
28+
29+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
30+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
31+
{
32+
if (env.IsDevelopment())
33+
{
34+
app.UseDeveloperExceptionPage();
35+
}
36+
else
37+
{
38+
app.UseExceptionHandler("/Home/Error");
39+
}
40+
41+
app.UseStaticFiles();
42+
43+
app.UseMvc(routes =>
44+
{
45+
routes.MapRoute(
46+
name: "default",
47+
template: "{controller=Home}/{action=Index}/{id?}");
48+
});
49+
}
50+
}
51+
}

jQuerySpa/Views/Home/Index.cshtml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
@{
2+
ViewData["Title"] = "Home Page";
3+
}
4+
5+
<div id="index-page" class="jumbotron">
6+
<div>
7+
<div>Action link navigation (shortcut is 'a')</div>
8+
@Html.ActionLink("Link to Table", "Table", "Home", null, new { data_shortcut = "a" })
9+
</div>
10+
<div>
11+
<div>Navigation using javascript window.location</div>
12+
<input id="navigate-button" type="button" class="btn" value="Navigate to Table" />
13+
</div>
14+
<div>
15+
<div>GET form with value for Home/Index</div>
16+
@using (Html.BeginForm("Table", "Home", FormMethod.Get))
17+
{
18+
@Html.TextBox("getText", "GET")
19+
<input type="submit" value="Submit GET Form" />
20+
}
21+
</div>
22+
<div>
23+
<div>POST form with value for Home/Index, but redirects to Home/About</div>
24+
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
25+
{
26+
@Html.TextBox("postText", "POST")
27+
<input type="submit" value="POST with Redirect" />
28+
}
29+
</div>
30+
<div>
31+
<div>GET form for Home/About, submitting button value</div>
32+
@using (Html.BeginForm("Table", "Home", FormMethod.Get))
33+
{
34+
<input type="submit" name="mySubmit" value="First" />
35+
<input type="submit" name="mySubmit" value="Second" />
36+
<input type="submit" value="Will not" />
37+
}
38+
</div>
39+
<div>
40+
<div>Action link to page with explicit layout</div>
41+
@Html.ActionLink("Link to Contact", "Contact", "Home")
42+
</div>
43+
<div>
44+
<div>Event attached to page, appends extra button</div>
45+
<input id="clone-button" type="button" class="btn" value="Global click event" />
46+
</div>
47+
<div>
48+
<div>Javascript state</div>
49+
Click counter: <input id="click-counter" type="text" />
50+
Interval counter: <input id="interval-counter" type="text" />
51+
</div>
52+
</div>
53+
54+
@section scripts
55+
{
56+
<script>
57+
$(function() {
58+
$('#navigate-button').click(function () {
59+
window.navigate('@Url.Action("Table", "Home")');
60+
});
61+
$('body').on('click', '#clone-button', function() {
62+
$(this).after($(this).clone());
63+
});
64+
65+
$('#click-counter').val(clickCount);
66+
$('#index-page').click(function () {
67+
window.clickCount++;
68+
$('#click-counter').val(window.clickCount);
69+
});
70+
71+
$('#interval-counter').val(window.times.length);
72+
setInterval(function () {
73+
var now = new Date();
74+
while (window.times.length > 0) {
75+
var front = window.times[0];
76+
if (now.getTime() - front.getTime() > 1000) {
77+
times.shift();
78+
} else {
79+
break;
80+
}
81+
}
82+
times.push(now);
83+
$('#interval-counter').val(window.times.length);
84+
}, 1000);
85+
})
86+
</script>
87+
}

jQuerySpa/Views/Home/Table.cshtml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@functions {
2+
private static Random random = new Random();
3+
public static string RandomString(int length)
4+
{
5+
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
6+
return new string(Enumerable.Repeat(chars, length)
7+
.Select(s => s[random.Next(s.Length)]).ToArray());
8+
}
9+
10+
}
11+
@{
12+
ViewBag.Title = "Table";
13+
14+
}
15+
<h3>@ViewBag.Message</h3>
16+
17+
<table id="table" class="display">
18+
<thead>
19+
<tr>
20+
<th>Column1</th>
21+
<th>Column2</th>
22+
<th>Column3</th>
23+
</tr>
24+
</thead>
25+
<tbody>
26+
@for (var i = 0; i < 100; i++)
27+
{
28+
<tr><td>@RandomString(8)</td><td>@RandomString(5)</td><td>@RandomString(6)</td></tr>
29+
}
30+
</tbody>
31+
</table>
32+
33+
@section scripts
34+
{
35+
<script>
36+
$(function () {
37+
$('#table').dataTable();
38+
});
39+
</script>
40+
}

jQuerySpa/Views/Shared/Error.cshtml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@model ErrorViewModel
2+
@{
3+
ViewData["Title"] = "Error";
4+
}
5+
6+
<h1 class="text-danger">Error.</h1>
7+
<h2 class="text-danger">An error occurred while processing your request.</h2>
8+
9+
@if (Model.ShowRequestId)
10+
{
11+
<p>
12+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
13+
</p>
14+
}
15+
16+
<h3>Development Mode</h3>
17+
<p>
18+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
</p>
20+
<p>
21+
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
22+
</p>

0 commit comments

Comments
 (0)