diff --git a/cicm_web/Controllers/CompanyController.cs b/cicm_web/Controllers/CompanyController.cs
index 9717f217..e3cb96bf 100644
--- a/cicm_web/Controllers/CompanyController.cs
+++ b/cicm_web/Controllers/CompanyController.cs
@@ -29,8 +29,10 @@
*******************************************************************************/
using cicm_web.Models;
+using Cicm.Database.Schemas;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
+using Company = cicm_web.Models.Company;
namespace cicm_web.Controllers
{
@@ -65,5 +67,23 @@ namespace cicm_web.Controllers
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
return View(company);
}
+
+ public IActionResult ByCountry(int id)
+ {
+ Iso3166 iso3166 = Program.Database.Operations.GetIso3166(id);
+
+ ViewBag.Iso3166 = iso3166;
+
+ Company[] companies = iso3166 == null ? Company.GetAllItems() : Company.GetItemsByCountry(id);
+
+ ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
+ return View(companies);
+ }
+
+ public IActionResult Index()
+ {
+ ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
+ return View(Company.GetAllItems());
+ }
}
}
\ No newline at end of file
diff --git a/cicm_web/Views/Company/ByCountry.cshtml b/cicm_web/Views/Company/ByCountry.cshtml
new file mode 100644
index 00000000..dacee866
--- /dev/null
+++ b/cicm_web/Views/Company/ByCountry.cshtml
@@ -0,0 +1,99 @@
+@{
+ /******************************************************************************
+// Canary Islands Computer Museum Website
+// ----------------------------------------------------------------------------
+//
+// Filename : ByCountry.cshtml
+// Author(s) : Natalia Portillo
+ @if(ViewBag.Iso3166 != null)
+ {
+ Companies founded in @ViewBag.Iso3166.Name
+ if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/flags/countries", ViewBag.Iso3166.Id + ".svg")))
+ {
+
+ @Model.Count() companies found in the database. There are no companies found in the database founded in the requested country.
+
+ }
+
+ @if(Model.Any())
+ {
+
+ @foreach(Company company in Model)
+ {
+
+ @if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
+ {
+
+
+ }
+
+ @if(Model.Any()) + { +
+ @Model.Count() companies found in the database.
+ @foreach(Company company in Model)
+ {
+
+ @if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
+ {
+
+
+ }
+
There are no companies in the database.
+ } + \ No newline at end of file