mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Optimize view of company descriptions admin page.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Cicm.Database.Models;
|
using Cicm.Database.Models;
|
||||||
|
using cicm_web.Areas.Admin.Models;
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -58,7 +59,11 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
IIncludableQueryable<CompanyDescription, Company> cicmContext =
|
IIncludableQueryable<CompanyDescription, Company> cicmContext =
|
||||||
_context.CompanyDescriptions.Include(c => c.Company);
|
_context.CompanyDescriptions.Include(c => c.Company);
|
||||||
return View(await cicmContext.OrderBy(c => c.Company.Name).ToListAsync());
|
return View(await cicmContext.OrderBy(c => c.Company.Name)
|
||||||
|
.Select(c => new CompanyDescriptionViewModel
|
||||||
|
{
|
||||||
|
Id = c.Id, Company = c.Company.Name
|
||||||
|
}).ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: CompanyDescription/Details/5
|
// GET: CompanyDescription/Details/5
|
||||||
|
|||||||
38
cicm_web/Areas/Admin/Models/CompanyDescriptionViewModel.cs
Normal file
38
cicm_web/Areas/Admin/Models/CompanyDescriptionViewModel.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : CompanyDescription.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Holds company descriptions.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
namespace cicm_web.Areas.Admin.Models
|
||||||
|
{
|
||||||
|
public class CompanyDescriptionViewModel
|
||||||
|
{
|
||||||
|
public string Company;
|
||||||
|
public int Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
// Copyright © 2003-2018 Natalia Portillo
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
}
|
}
|
||||||
@using Cicm.Database.Models
|
@using cicm_web.Areas.Admin.Models
|
||||||
@model IEnumerable<Cicm.Database.Models.CompanyDescription>
|
@model IEnumerable<cicm_web.Areas.Admin.Models.CompanyDescriptionViewModel>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Company descriptions (Admin)";
|
ViewData["Title"] = "Company descriptions (Admin)";
|
||||||
@@ -54,11 +54,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach(CompanyDescription item in Model)
|
@foreach(CompanyDescriptionViewModel item in Model)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Company.Name)
|
@Html.DisplayFor(modelItem => item.Company)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="Details"
|
<a asp-action="Details"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.545</Version>
|
<Version>3.0.99.547</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user