mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add alias and display name to people.
This commit is contained in:
8194
Cicm.Database/Migrations/20190630202244_AddDisplayNameAndAliasToPerson.Designer.cs
generated
Normal file
8194
Cicm.Database/Migrations/20190630202244_AddDisplayNameAndAliasToPerson.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Cicm.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddDisplayNameAndAliasToPerson : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>("Alias", "People", nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>("DisplayName", "People", nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex("IX_People_Alias", "People", "Alias");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex("IX_People_DisplayName", "People", "DisplayName");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex("IX_People_Alias", "People");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex("IX_People_DisplayName", "People");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn("Alias", "People");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn("DisplayName", "People");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4958,12 +4958,16 @@ namespace Cicm.Database.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id").ValueGeneratedOnAdd();
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Alias");
|
||||||
|
|
||||||
b.Property<DateTime>("BirthDate");
|
b.Property<DateTime>("BirthDate");
|
||||||
|
|
||||||
b.Property<short?>("CountryOfBirthId");
|
b.Property<short?>("CountryOfBirthId");
|
||||||
|
|
||||||
b.Property<DateTime?>("DeathDate");
|
b.Property<DateTime?>("DeathDate");
|
||||||
|
|
||||||
|
b.Property<string>("DisplayName");
|
||||||
|
|
||||||
b.Property<int?>("DocumentPersonId");
|
b.Property<int?>("DocumentPersonId");
|
||||||
|
|
||||||
b.Property<string>("Facebook");
|
b.Property<string>("Facebook");
|
||||||
@@ -4980,12 +4984,16 @@ namespace Cicm.Database.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Alias");
|
||||||
|
|
||||||
b.HasIndex("BirthDate");
|
b.HasIndex("BirthDate");
|
||||||
|
|
||||||
b.HasIndex("CountryOfBirthId");
|
b.HasIndex("CountryOfBirthId");
|
||||||
|
|
||||||
b.HasIndex("DeathDate");
|
b.HasIndex("DeathDate");
|
||||||
|
|
||||||
|
b.HasIndex("DisplayName");
|
||||||
|
|
||||||
b.HasIndex("Facebook");
|
b.HasIndex("Facebook");
|
||||||
|
|
||||||
b.HasIndex("Name");
|
b.HasIndex("Name");
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ namespace Cicm.Database.Models
|
|||||||
public string Facebook { get; set; }
|
public string Facebook { get; set; }
|
||||||
public Guid Photo { get; set; }
|
public Guid Photo { get; set; }
|
||||||
public int? DocumentPersonId { get; set; }
|
public int? DocumentPersonId { get; set; }
|
||||||
|
public string Alias { get; set; }
|
||||||
|
[DisplayName("Name to be displayed")]
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
[DisplayName("Name")]
|
[DisplayName("Name")]
|
||||||
public string FullName => $"{Name} {Surname}";
|
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
|
||||||
|
|
||||||
public short? CountryOfBirthId { get; set; }
|
public short? CountryOfBirthId { get; set; }
|
||||||
public virtual ICollection<PeopleByCompany> Companies { get; set; }
|
public virtual ICollection<PeopleByCompany> Companies { get; set; }
|
||||||
|
|||||||
@@ -1076,6 +1076,10 @@ namespace Cicm.Database.Models
|
|||||||
|
|
||||||
entity.HasIndex(e => e.Photo);
|
entity.HasIndex(e => e.Photo);
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Alias);
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.DisplayName);
|
||||||
|
|
||||||
entity.HasOne(d => d.CountryOfBirth).WithMany(p => p.People).HasForeignKey(d => d.CountryOfBirthId);
|
entity.HasOne(d => d.CountryOfBirth).WithMany(p => p.People).HasForeignKey(d => d.CountryOfBirthId);
|
||||||
|
|
||||||
entity.HasOne(d => d.DocumentPerson).WithOne(p => p.Person)
|
entity.HasOne(d => d.DocumentPerson).WithOne(p => p.Person)
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create(
|
public async Task<IActionResult> Create(
|
||||||
[Bind("Name,Surname,BirthDate,DeathDate,Webpage,Twitter,Facebook,Photo,CountryOfBirthId,Id")]
|
[Bind(
|
||||||
|
"Name,Surname,BirthDate,DeathDate,Webpage,Twitter,Facebook,Photo,CountryOfBirthId,Id,Alias,DisplayName")]
|
||||||
Person person)
|
Person person)
|
||||||
{
|
{
|
||||||
if(ModelState.IsValid)
|
if(ModelState.IsValid)
|
||||||
@@ -85,7 +86,8 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(
|
public async Task<IActionResult> Edit(
|
||||||
int id, [Bind("Name,Surname,BirthDate,DeathDate,Webpage,Twitter,Facebook,Photo,CountryOfBirthId,Id")]
|
int id, [Bind(
|
||||||
|
"Name,Surname,BirthDate,DeathDate,Webpage,Twitter,Facebook,Photo,CountryOfBirthId,Id,Alias,DisplayName")]
|
||||||
Person person)
|
Person person)
|
||||||
{
|
{
|
||||||
if(id != person.Id) return NotFound();
|
if(id != person.Id) return NotFound();
|
||||||
|
|||||||
@@ -24,6 +24,26 @@
|
|||||||
class="text-danger">
|
class="text-danger">
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Alias"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="Alias"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="Alias"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="DisplayName"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="DisplayName"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="DisplayName"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Surname"
|
<label asp-for="Surname"
|
||||||
class="control-label">
|
class="control-label">
|
||||||
@@ -97,7 +117,10 @@
|
|||||||
<input class="btn btn-primary"
|
<input class="btn btn-primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="Create" />
|
value="Create" />
|
||||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,6 +23,18 @@
|
|||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Surname)
|
@Html.DisplayFor(model => model.Surname)
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Alias)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Alias)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.DisplayName)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.DisplayName)
|
||||||
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.CountryOfBirth)
|
@Html.DisplayNameFor(model => model.CountryOfBirth)
|
||||||
</dt>
|
</dt>
|
||||||
@@ -66,10 +78,16 @@
|
|||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form asp-action="Delete">
|
<form asp-action="Delete">
|
||||||
<input type="hidden" asp-for="Id" />
|
<input type="hidden"
|
||||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
asp-for="Id" />
|
||||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
<input class="btn btn-danger"
|
||||||
|
type="submit"
|
||||||
|
value="Delete" />
|
||||||
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -22,6 +22,18 @@
|
|||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Surname)
|
@Html.DisplayFor(model => model.Surname)
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Alias)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Alias)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.DisplayName)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.DisplayName)
|
||||||
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.CountryOfBirth)
|
@Html.DisplayNameFor(model => model.CountryOfBirth)
|
||||||
</dt>
|
</dt>
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<form asp-action="Edit">
|
<form asp-action="Edit">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ModelOnly"
|
||||||
|
class="text-danger">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Name"
|
<label asp-for="Name"
|
||||||
class="control-label">
|
class="control-label">
|
||||||
@@ -32,6 +34,26 @@
|
|||||||
class="text-danger">
|
class="text-danger">
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Alias"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="Alias"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="Alias"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="DisplayName"
|
||||||
|
class="control-label">
|
||||||
|
</label>
|
||||||
|
<input asp-for="DisplayName"
|
||||||
|
class="form-control" />
|
||||||
|
<span asp-validation-for="DisplayName"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="BirthDate"
|
<label asp-for="BirthDate"
|
||||||
class="control-label">
|
class="control-label">
|
||||||
@@ -91,10 +113,16 @@
|
|||||||
asp-items="ViewBag.CountryOfBirthId">
|
asp-items="ViewBag.CountryOfBirthId">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" asp-for="Id" />
|
<input type="hidden"
|
||||||
|
asp-for="Id" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="submit" value="Save" class="btn btn-primary" />
|
<input class="btn btn-primary"
|
||||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
type="submit"
|
||||||
|
value="Save" />
|
||||||
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,4 +130,4 @@
|
|||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||||
}
|
}
|
||||||
@@ -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.869</Version>
|
<Version>3.0.99.872</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