#224 removing redundant data
This commit is contained in:
parent
954e32ec84
commit
827fa3501b
@ -69,6 +69,11 @@
|
||||
<input type="text" name="@($"pinorder-{poet.Id}")" id="@($"pinorder-{poet.Id}")" value="@poet.PinOrder" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
@Html.Raw(poet.Description)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
|
||||
@ -10,7 +10,7 @@ using RMuseum.DbContext;
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
[DbContext(typeof(RMuseumDbContext))]
|
||||
[Migration("20211021145514_GanjoorHalfCenturies")]
|
||||
[Migration("20211021153153_GanjoorHalfCenturies")]
|
||||
partial class GanjoorHalfCenturies
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -839,7 +839,7 @@ namespace RMuseum.Migrations
|
||||
b.Property<int?>("GanjoorHalfCenturyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoetId")
|
||||
b.Property<int?>("PoetId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoetOrder")
|
||||
@ -2735,9 +2735,7 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PoetId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("PoetId");
|
||||
|
||||
b.Navigation("Poet");
|
||||
});
|
||||
@ -51,7 +51,7 @@ namespace RMuseum.Migrations
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PoetOrder = table.Column<int>(type: "int", nullable: false),
|
||||
PoetId = table.Column<int>(type: "int", nullable: false),
|
||||
PoetId = table.Column<int>(type: "int", nullable: true),
|
||||
GanjoorHalfCenturyId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
@ -68,7 +68,7 @@ namespace RMuseum.Migrations
|
||||
column: x => x.PoetId,
|
||||
principalTable: "GanjoorPoets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
@ -837,7 +837,7 @@ namespace RMuseum.Migrations
|
||||
b.Property<int?>("GanjoorHalfCenturyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoetId")
|
||||
b.Property<int?>("PoetId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoetOrder")
|
||||
@ -2733,9 +2733,7 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PoetId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("PoetId");
|
||||
|
||||
b.Navigation("Poet");
|
||||
});
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
/// <summary>
|
||||
/// poet id
|
||||
/// </summary>
|
||||
public int PoetId { get; set; }
|
||||
public int? PoetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// poet
|
||||
/// </summary>
|
||||
public GanjoorPoet Poet { get; set; }
|
||||
public virtual GanjoorPoet Poet { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,9 +22,11 @@ namespace RMuseum.Services.Implementation
|
||||
{
|
||||
try
|
||||
{
|
||||
var oldOnes = await _context.GanjoorHalfCenturies.Include(o => o.Poets)).ToArrayAsync();
|
||||
await _context.Database.ExecuteSqlRawAsync("DELETE FROM GanjoorPeriodPoet");
|
||||
var oldOnes = await _context.GanjoorHalfCenturies.ToArrayAsync();
|
||||
_context.RemoveRange(oldOnes);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
||||
var periods = new List<GanjoorHalfCentury>
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user