forked from mopsy-team/Mopsik-WWW
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Klaudia Laks
committed
Apr 30, 2018
0 parents
commit ea7ce81
Showing
94 changed files
with
40,899 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26730.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mopsik_www", "mopsik_www\mopsik_www.csproj", "{0E2C6A93-950B-43D8-9B01-06E66FC028E8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0E2C6A93-950B-43D8-9B01-06E66FC028E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0E2C6A93-950B-43D8-9B01-06E66FC028E8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0E2C6A93-950B-43D8-9B01-06E66FC028E8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0E2C6A93-950B-43D8-9B01-06E66FC028E8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {21EEDCA6-2869-4CC8-A97F-B2966A3591AD} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "wwwroot/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace mopsik_www.Controllers | ||
{ | ||
public class MapController : Controller | ||
{ | ||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
public IActionResult Map() | ||
{ | ||
ViewData["Message"] = "Your application description page."; | ||
|
||
return View(); | ||
} | ||
|
||
public IActionResult Contact() | ||
{ | ||
ViewData["Message"] = "Your contact page."; | ||
|
||
return View(); | ||
} | ||
|
||
public IActionResult Error() | ||
{ | ||
return View(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using mopsik_www.Models; | ||
using mopsik_www.ViewModels; | ||
|
||
namespace mopsik_www.Controllers | ||
{ | ||
public class SearchController : Controller | ||
{ | ||
private ApiManager apiManager = new ApiManager(); | ||
|
||
public async Task<ActionResult> Search2() | ||
{ | ||
|
||
return View("Search", | ||
await apiManager.GetMopsAsync() | ||
); | ||
} | ||
|
||
public async Task<string> Search() | ||
{ | ||
|
||
return await apiManager.GetMopsAsync(); | ||
} | ||
|
||
public ActionResult AddNew() | ||
{ | ||
return View("CreateEmployee"); | ||
} | ||
|
||
public ActionResult SaveEmployee(Mop e, string BtnSubmit) | ||
{ | ||
switch (BtnSubmit) | ||
{ | ||
case "Save Employee": | ||
if (ModelState.IsValid) | ||
{ | ||
return Content(e.FirstName + "|" + e.LastName + "|" + e.Salary); | ||
} | ||
else | ||
{ | ||
return View("CreateEmployee"); | ||
} | ||
case "Cancel": | ||
return RedirectToAction("Index"); | ||
} | ||
return new EmptyResult(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using System.Net.Http; | ||
using Newtonsoft.Json; | ||
|
||
namespace mopsik_www.Models | ||
{ | ||
public class ApiManager | ||
{ | ||
|
||
readonly string uri = "http://reach.mimuw.edu.pl:8008/mops/"; | ||
|
||
public async Task<string> GetMopsAsync() | ||
{ | ||
|
||
using (HttpClient httpClient = new HttpClient()) | ||
{ | ||
/* | ||
return JsonConvert.DeserializeObject<List<Mop>>( | ||
await httpClient.GetStringAsync(uri) | ||
); | ||
*/ | ||
return await httpClient.GetStringAsync(uri); | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace mopsik_www.Models | ||
{ | ||
public class Coordinates | ||
{ | ||
|
||
[JsonProperty("longitude")] | ||
public double Longitude { get; set; } | ||
[JsonProperty("latitude")] | ||
public double Latitude { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace mopsik_www.Models | ||
{ | ||
public class Facilities | ||
{ | ||
[JsonProperty("monitoring")] | ||
public bool Monitoring { get; set; } | ||
[JsonProperty("garage")] | ||
public bool Garage { get; set; } | ||
[JsonProperty("toilets")] | ||
public bool Toilets { get; set; } | ||
[JsonProperty("petrol_station")] | ||
public bool PetrolStation { get; set; } | ||
[JsonProperty("dangerous_cargo_places")] | ||
public bool DangerousCargoPlaces { get; set; } | ||
[JsonProperty("fence")] | ||
public bool Fence { get; set; } | ||
[JsonProperty("restaurant")] | ||
public bool Restaurant { get; set; } | ||
[JsonProperty("sleeping_places")] | ||
public bool SleepingPlaces { get; set; } | ||
[JsonProperty("car_wash")] | ||
public bool CarWash { get; set; } | ||
[JsonProperty("lighting")] | ||
public bool Lighting { get; set; } | ||
[JsonProperty("security")] | ||
public bool Security { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace mopsik_www.Models | ||
{ | ||
public class Mop | ||
{ | ||
|
||
[JsonProperty("id")] | ||
public int Id { get; set; } | ||
[JsonProperty("title")] | ||
public string Title { get; set; } | ||
[JsonProperty("chainage")] | ||
public string Chainage { get; set; } | ||
[JsonProperty("direction")] | ||
public string Direction { get; set; } | ||
[JsonProperty("road_number")] | ||
public string RoadNumber { get; set; } | ||
[JsonProperty("town")] | ||
public string Town { get; set; } | ||
[JsonProperty("operator")] | ||
public Operator Operator { get; set; } | ||
[JsonProperty("facilities")] | ||
public Facilities Facilities { get; set; } | ||
[JsonProperty("coords")] | ||
public Coordinates Coordinates { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace mopsik_www.Models | ||
{ | ||
public class Operator | ||
{ | ||
[JsonProperty("email")] | ||
public string Email { get; set; } | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
[JsonProperty("phone")] | ||
public string Phone { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace mopsik_www.Models | ||
{ | ||
public class SpacesCount | ||
{ | ||
|
||
[JsonProperty("bus")] | ||
public int Bus { get; set; } | ||
[JsonProperty("car")] | ||
public int Car { get; set; } | ||
[JsonProperty("truck")] | ||
public int Truck { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Hosting; | ||
|
||
namespace mopsik_www | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
var host = new WebHostBuilder() | ||
.UseKestrel() | ||
.UseContentRoot(Directory.GetCurrentDirectory()) | ||
.UseIISIntegration() | ||
.UseStartup<Startup>() | ||
.UseApplicationInsights() | ||
.Build(); | ||
|
||
host.Run(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:64152/", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"mopsik_www": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "http://localhost:64153/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
| ||
ASP.NET MVC core dependencies have been added to the project. | ||
(These dependencies include packages required to enable scaffolding) | ||
|
||
However you may still need to do make changes to your project. | ||
|
||
1. Suggested changes to Startup class: | ||
1.1 Add a constructor: | ||
public IConfigurationRoot Configuration { get; } | ||
|
||
public Startup(IHostingEnvironment env) | ||
{ | ||
var builder = new ConfigurationBuilder() | ||
.SetBasePath(env.ContentRootPath) | ||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) | ||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) | ||
.AddEnvironmentVariables(); | ||
Configuration = builder.Build(); | ||
} | ||
1.2 Add MVC services: | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
// Add framework services. | ||
services.AddMvc(); | ||
} | ||
|
||
1.3 Configure web app to use use Configuration and use MVC routing: | ||
|
||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) | ||
{ | ||
loggerFactory.AddConsole(Configuration.GetSection("Logging")); | ||
loggerFactory.AddDebug(); | ||
|
||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
else | ||
{ | ||
app.UseExceptionHandler("/Home/Error"); | ||
} | ||
|
||
app.UseStaticFiles(); | ||
|
||
app.UseMvc(routes => | ||
{ | ||
routes.MapRoute( | ||
name: "default", | ||
template: "{controller=Home}/{action=Index}/{id?}"); | ||
}); | ||
} |
Oops, something went wrong.