Skip to content

Commit

Permalink
HomeController
Browse files Browse the repository at this point in the history
  • Loading branch information
Oktawian-L committed Nov 9, 2019
1 parent 5bf6fe9 commit 77ca60d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
33 changes: 33 additions & 0 deletions SubitonAPI/SubitonAPI/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace SubitonAPI.Controllers
{
[ApiController]
[Route("[controller]")]
public class HomeController : Controller
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

[HttpGet]
public /*IActionResult*/IEnumerable<WeatherForecast> Index()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();

// return View();
}
}
}
4 changes: 2 additions & 2 deletions SubitonAPI/SubitonAPI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"launchUrl": "home",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SubitonAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"launchUrl": "home",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
Expand Down
23 changes: 23 additions & 0 deletions SubitonAPI/SubitonAPI/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>@ViewData["Title"] - WebApplication1</title>

<environment include="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment exclude="Development">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>
</head>
<body>
<h1>hello</h1>
</body>
</html>

0 comments on commit 77ca60d

Please sign in to comment.