mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add company details in admin view.
This commit is contained in:
@@ -103,7 +103,7 @@ namespace Marechai.Database.Models
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http: //go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http: //go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||||
optionsBuilder.UseMySql("server=localhost;port=3306;user=marechai;password=marechaipass;database=marechai");
|
optionsBuilder.UseMySql("server=zeus.claunia.com;port=3306;user=marechai;password=marechaipass;database=marechai");
|
||||||
optionsBuilder.UseLazyLoadingProxies();
|
optionsBuilder.UseLazyLoadingProxies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
@{
|
|
||||||
/******************************************************************************
|
|
||||||
// MARECHAI: Master repository of computing history artifacts information
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Filename : Details.cshtml
|
|
||||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
||||||
//
|
|
||||||
// --[ Description ] ----------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Admin view details
|
|
||||||
//
|
|
||||||
// --[ 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-2020 Natalia Portillo
|
|
||||||
*******************************************************************************/
|
|
||||||
}
|
|
||||||
@model Marechai.Database.Models.Company
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Details";
|
|
||||||
}
|
|
||||||
<h2>Details</h2>
|
|
||||||
<div>
|
|
||||||
<h4>Company</h4>
|
|
||||||
<hr />
|
|
||||||
<dl class="dl-horizontal">
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Name)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Name)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Founded)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Founded)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Website)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Website)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Twitter)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Twitter)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Facebook)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Facebook)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Sold)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Sold)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Address)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Address)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.City)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.City)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Province)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Province)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.PostalCode)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.PostalCode)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Status)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Status)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Country)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Country.Name)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.SoldTo)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.SoldTo.Name)
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">Edit</a>
|
|
||||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
|
||||||
</div>
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<Version>3.0.99.1100</Version>
|
<Version>3.0.99.1159</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Skia.Linux.Natives" Version="1.68.0.2" />
|
<PackageReference Include="Avalonia.Skia.Linux.Natives" Version="1.68.0.2" />
|
||||||
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.0.3" />
|
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.1-preview1" />
|
||||||
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.0.3" />
|
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.1-preview1" />
|
||||||
<PackageReference Include="Markdig" Version="0.20.0" />
|
<PackageReference Include="Markdig" Version="0.20.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.4" />
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
@page "/admin/companies"
|
@page "/admin/companies"
|
||||||
@inherits OwningComponentBase<CompaniesService>
|
@inherits OwningComponentBase<CompaniesService>
|
||||||
@inject IStringLocalizer<CompaniesService> L
|
@inject IStringLocalizer<CompaniesService> L
|
||||||
|
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Companies"]</h3>
|
<h3>@L["Companies"]</h3>
|
||||||
@if (_companies is null)
|
@if (_companies is null)
|
||||||
@@ -88,9 +89,7 @@
|
|||||||
@item.SoldTo
|
@item.SoldTo
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="btn btn-primary">
|
<a class="btn btn-primary" href="/admin/companies/details/@item.Id">@L["Details"]</a>
|
||||||
@L["Details"]
|
|
||||||
</span>
|
|
||||||
<span class="btn btn-secondary">
|
<span class="btn btn-secondary">
|
||||||
@L["Edit"]
|
@L["Edit"]
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
162
Marechai/Pages/Admin/Details/Company.razor
Normal file
162
Marechai/Pages/Admin/Details/Company.razor
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// MARECHAI: Master repository of computing history artifacts information
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Details.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Admin view details
|
||||||
|
//
|
||||||
|
// --[ 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-2020 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
|
||||||
|
@page "/admin/companies/details/{Id:int}"
|
||||||
|
@inherits OwningComponentBase<CompaniesService>
|
||||||
|
@inject IStringLocalizer<CompaniesService> L
|
||||||
|
@inject Iso31661NumericService CountriesService
|
||||||
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
|
<h3>@L["Company details"]</h3>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
@if (!_loaded)
|
||||||
|
{
|
||||||
|
<p align="center">@L["Loading..."]</p>
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Name"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name"/>
|
||||||
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Status"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@CompanyStatus"/>
|
||||||
|
</Field>
|
||||||
|
@if(_editable || _model.Founded.HasValue)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Founded"]</FieldLabel>
|
||||||
|
<DateEdit ReadOnly="!_editable" TValue="DateTime?" @bind-Date="@_model.Founded"/>
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.Website != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Website"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Website" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.Twitter != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Twitter"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Twitter" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.Facebook != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Facebook"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Facebook" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.Address != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Address"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Address" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.City != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["City"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.City" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.Province != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Province"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Province" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.PostalCode != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Postal code"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.PostalCode" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Country"]</FieldLabel>
|
||||||
|
<Select ReadOnly="!_editable" TValue="short?" @bind-SelectedValue="@_model.CountryId">
|
||||||
|
@foreach (var country in _countries)
|
||||||
|
{
|
||||||
|
<SelectItem Value="@country.Id">@country.Name</SelectItem>
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
else if (_model.CountryId != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Country"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Country.Name" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable || _model.Sold != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Sold"]</FieldLabel>
|
||||||
|
<DateEdit ReadOnly="!_editable" TValue="DateTime?" @bind-Date="@_model.Sold" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
@if (_editable)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Sold to"]</FieldLabel>
|
||||||
|
<Select ReadOnly="!_editable" TValue="int?" @bind-SelectedValue="@_model.SoldToId">
|
||||||
|
@foreach (var company in _companies)
|
||||||
|
{
|
||||||
|
<SelectItem Value="@company.Id">@company.Name</SelectItem>
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
else if (_model.SoldToId != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Sold to"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.SoldTo.Name" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="btn btn-primary">@L["Edit"]</span>
|
||||||
|
<a href="/admin/companies" class="btn btn-secondary">@L["Back to list"]</a>
|
||||||
|
</div>
|
||||||
50
Marechai/Pages/Admin/Details/Company.razor.cs
Normal file
50
Marechai/Pages/Admin/Details/Company.razor.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Marechai.Database;
|
||||||
|
using Marechai.Database.Models;
|
||||||
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace Marechai.Pages.Admin.Details
|
||||||
|
{
|
||||||
|
public partial class Company
|
||||||
|
{
|
||||||
|
List<CompanyViewModel> _companies;
|
||||||
|
List<Iso31661Numeric> _countries;
|
||||||
|
bool _editable;
|
||||||
|
bool _loaded;
|
||||||
|
Database.Models.Company _model;
|
||||||
|
[Parameter]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string CompanyStatus
|
||||||
|
{
|
||||||
|
get => _model.Status.ToString();
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(!Enum.TryParse(value, true, out CompanyStatus parsed))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_model.Status = parsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if(_loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_loaded = true;
|
||||||
|
|
||||||
|
if(Id <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_countries = await CountriesService.GetAsync();
|
||||||
|
_companies = await Service.GetAsync();
|
||||||
|
_model = await Service.GetAsync(Id);
|
||||||
|
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace Marechai.Pages.Companies
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_company = await Service.GetCompanyAsync(Id);
|
_company = await Service.GetAsync(Id);
|
||||||
List<Machine> machines = await Service.GetMachinesAsync(Id);
|
List<Machine> machines = await Service.GetMachinesAsync(Id);
|
||||||
|
|
||||||
_computers = machines.Where(m => m.Type == MachineType.Computer).ToList();
|
_computers = machines.Where(m => m.Type == MachineType.Computer).ToList();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
// MARECHAI: Master repository of computing history artifacts information
|
// MARECHAI: Master repository of computing history artifacts information
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -114,7 +114,7 @@ namespace Marechai
|
|||||||
|
|
||||||
Console.WriteLine("\u001b[31;1mUpdating MySQL database without Entity Framework if it exists...\u001b[0m");
|
Console.WriteLine("\u001b[31;1mUpdating MySQL database without Entity Framework if it exists...\u001b[0m");
|
||||||
Database = new Mysql();
|
Database = new Mysql();
|
||||||
bool res = Database.OpenDb("localhost", "marechai", "marechai", "marechaipass", 3306);
|
bool res = Database.OpenDb("zeus.claunia.com", "marechai", "marechai", "marechaipass", 3306);
|
||||||
|
|
||||||
if(res)
|
if(res)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -290,4 +290,28 @@
|
|||||||
<value>Cancelar</value>
|
<value>Cancelar</value>
|
||||||
<comment>Cancel</comment>
|
<comment>Cancel</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Company details" xml:space="preserve">
|
||||||
|
<value>Detalles de compañía</value>
|
||||||
|
<comment>Company details</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Name" xml:space="preserve">
|
||||||
|
<value>Nombre</value>
|
||||||
|
<comment>Name</comment>
|
||||||
|
</data>
|
||||||
|
<data name="City" xml:space="preserve">
|
||||||
|
<value>Ciudad</value>
|
||||||
|
<comment>City</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Province" xml:space="preserve">
|
||||||
|
<value>Provincia</value>
|
||||||
|
<comment>Province</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Postal code" xml:space="preserve">
|
||||||
|
<value>Código postal</value>
|
||||||
|
<comment>Postal code</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Back to list" xml:space="preserve">
|
||||||
|
<value>Volver a la lista</value>
|
||||||
|
<comment>Back to list</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -62,7 +62,7 @@ namespace Marechai.Services
|
|||||||
Status = c.Status
|
Status = c.Status
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
public Task<Company> GetCompanyAsync(int id) => _context.Companies.FirstOrDefaultAsync(c => c.Id == id);
|
public Task<Company> GetAsync(int id) => _context.Companies.FirstOrDefaultAsync(c => c.Id == id);
|
||||||
|
|
||||||
public async Task<List<Machine>> GetMachinesAsync(int id) =>
|
public async Task<List<Machine>> GetMachinesAsync(int id) =>
|
||||||
await _context.Machines.Where(m => m.CompanyId == id).OrderBy(m => m.Name).Select(m => new Machine
|
await _context.Machines.Where(m => m.CompanyId == id).OrderBy(m => m.Name).Select(m => new Machine
|
||||||
|
|||||||
18
Marechai/Services/Iso31661NumericService.cs
Normal file
18
Marechai/Services/Iso31661NumericService.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Marechai.Database.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Marechai.Services
|
||||||
|
{
|
||||||
|
public class Iso31661NumericService
|
||||||
|
{
|
||||||
|
readonly MarechaiContext _context;
|
||||||
|
|
||||||
|
public Iso31661NumericService(MarechaiContext context) => _context = context;
|
||||||
|
|
||||||
|
public async Task<List<Iso31661Numeric>> GetAsync() =>
|
||||||
|
await _context.Iso31661Numeric.OrderBy(c => c.Name).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,6 +59,7 @@ namespace Marechai.Services
|
|||||||
services.AddScoped<ProcessorsService>();
|
services.AddScoped<ProcessorsService>();
|
||||||
services.AddScoped<ScreensService>();
|
services.AddScoped<ScreensService>();
|
||||||
services.AddScoped<SoundSynthsService>();
|
services.AddScoped<SoundSynthsService>();
|
||||||
|
services.AddScoped<Iso31661NumericService>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "server=localhost;port=3306;user=marechai;password=marechaipass;database=marechai;TreatTinyAsBoolean=false"
|
"DefaultConnection": "server=zeus.claunia.com;port=3306;user=marechai;password=marechaipass;database=marechai;TreatTinyAsBoolean=false"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"projectId":"fd3f3857-80b9-4ed7-90f8-c6ebd0ae449f","projectName":"Marechai"}
|
{"projectId":"fd3f3857-80b9-4ed7-90f8-c6ebd0ae449f","projectName":"Marechai","neverTrack":false}
|
||||||
Reference in New Issue
Block a user