Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaudia Laks committed Apr 30, 2018
0 parents commit ea7ce81
Show file tree
Hide file tree
Showing 94 changed files with 40,899 additions and 0 deletions.
997 changes: 997 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added .vs/mopsik_www/v15/.suo
Binary file not shown.
Binary file added .vs/mopsik_www/v15/sqlite3/storage.ide
Binary file not shown.
25 changes: 25 additions & 0 deletions mopsik_www.sln
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
3 changes: 3 additions & 0 deletions mopsik_www/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "wwwroot/lib"
}
35 changes: 35 additions & 0 deletions mopsik_www/Controllers/MapController.cs
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();
}
}
}
53 changes: 53 additions & 0 deletions mopsik_www/Controllers/SearchController.cs
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();
}
}
}
28 changes: 28 additions & 0 deletions mopsik_www/Models/ApiManager.cs
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);

}
}
}
}
17 changes: 17 additions & 0 deletions mopsik_www/Models/Coordinates.cs
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; }
}
}
34 changes: 34 additions & 0 deletions mopsik_www/Models/Facilities.cs
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; }
}
}
33 changes: 33 additions & 0 deletions mopsik_www/Models/Mop.cs
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; }

}
}
18 changes: 18 additions & 0 deletions mopsik_www/Models/Operator.cs
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; }
}
}
19 changes: 19 additions & 0 deletions mopsik_www/Models/SpacesCount.cs
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; }
}
}
25 changes: 25 additions & 0 deletions mopsik_www/Program.cs
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();
}
}
}
27 changes: 27 additions & 0 deletions mopsik_www/Properties/launchSettings.json
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/"
}
}
}
51 changes: 51 additions & 0 deletions mopsik_www/ScaffoldingReadMe.txt
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?}");
});
}
Loading

0 comments on commit ea7ce81

Please sign in to comment.