changeOfConnections commit
This commit is contained in:
parent
d4966200cd
commit
e8c134f8d3
@ -28,7 +28,6 @@ namespace HotelDataBaseImplement
|
||||
public virtual DbSet<ConferenceBookingDinner> ConferenceBookingDinners { set; get; }
|
||||
public virtual DbSet<ConferenceParticipant> ConferenceParticipants { set; get; }
|
||||
public virtual DbSet<MealPlanParticipant> MealPlanParticipants { set; get; }
|
||||
public virtual DbSet<MealPlanRoom> MealPlanRooms { set; get; }
|
||||
public virtual DbSet<RoomDinner> RoomDinners { set; get; }
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,6 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.ConferenceParticipants)
|
||||
.ThenInclude(x => x.Conference)
|
||||
.Include(x => x.Rooms)
|
||||
.ThenInclude(x => x.Room)
|
||||
.ThenInclude(x => x.Dinners)
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.Include(x => x.Organiser)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -48,9 +45,6 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.ConferenceParticipants)
|
||||
.ThenInclude(x => x.Conference)
|
||||
.Include(x => x.Rooms)
|
||||
.ThenInclude(x => x.Room)
|
||||
.ThenInclude(x => x.Dinners)
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.Include(x => x.Organiser)
|
||||
.Where(x => x.OrganiserId == model.OrganiserId)
|
||||
.ToList()
|
||||
@ -64,9 +58,6 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.ConferenceParticipants)
|
||||
.ThenInclude(x => x.Conference)
|
||||
.Include(x => x.Rooms)
|
||||
.ThenInclude(x => x.Room)
|
||||
.ThenInclude(x => x.Dinners)
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.Include(x => x.Organiser)
|
||||
.Where(x => x.MealPlanName.Contains(model.MealPlanName))
|
||||
.ToList()
|
||||
@ -89,9 +80,6 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.ConferenceParticipants)
|
||||
.ThenInclude(x => x.Conference)
|
||||
.Include(x => x.Rooms)
|
||||
.ThenInclude(x => x.Room)
|
||||
.ThenInclude(x => x.Dinners)
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.Include(x => x.Organiser)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.MealPlanName) && x.MealPlanName == model.MealPlanName) || (model.Id.HasValue && x.Id == model.Id))?
|
||||
.GetViewModel;
|
||||
@ -115,9 +103,6 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.ConferenceParticipants)
|
||||
.ThenInclude(x => x.Conference)
|
||||
.Include(x => x.Rooms)
|
||||
.ThenInclude(x => x.Room)
|
||||
.ThenInclude(x => x.Dinners)
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.Include(x => x.Organiser)
|
||||
.FirstOrDefault(x => x.Id == newMealPlan.Id)
|
||||
?.GetViewModel;
|
||||
|
@ -23,10 +23,7 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.ThenInclude(x => x.ConferenceBookingDinner)
|
||||
.ThenInclude(x => x.ConferenceBooking)
|
||||
.Include(x => x.MealPlanRooms)
|
||||
.ThenInclude(x => x.MealPlan)
|
||||
.ThenInclude(x => x.Participants)
|
||||
.ThenInclude(x => x.Participant)
|
||||
.Include(x => x.MealPlan)
|
||||
.Include(x => x.Administrator)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
@ -49,10 +46,7 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.ThenInclude(x => x.ConferenceBookingDinner)
|
||||
.ThenInclude(x => x.ConferenceBooking)
|
||||
.Include(x => x.MealPlanRooms)
|
||||
.ThenInclude(x => x.MealPlan)
|
||||
.ThenInclude(x => x.Participants)
|
||||
.ThenInclude(x => x.Participant)
|
||||
.Include(x => x.MealPlan)
|
||||
.Include(x => x.Administrator)
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.AdministratorId == model.AdministratorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
@ -65,10 +59,7 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.ThenInclude(x => x.ConferenceBookingDinner)
|
||||
.ThenInclude(x => x.ConferenceBooking)
|
||||
.Include(x => x.MealPlanRooms)
|
||||
.ThenInclude(x => x.MealPlan)
|
||||
.ThenInclude(x => x.Participants)
|
||||
.ThenInclude(x => x.Participant)
|
||||
.Include(x => x.MealPlan)
|
||||
.Include(x => x.Administrator)
|
||||
.Where(x => x.AdministratorId == model.AdministratorId)
|
||||
.ToList()
|
||||
@ -81,10 +72,7 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.ThenInclude(x => x.ConferenceBookingDinner)
|
||||
.ThenInclude(x => x.ConferenceBooking)
|
||||
.Include(x => x.MealPlanRooms)
|
||||
.ThenInclude(x => x.MealPlan)
|
||||
.ThenInclude(x => x.Participants)
|
||||
.ThenInclude(x => x.Participant)
|
||||
.Include(x => x.MealPlan)
|
||||
.Include(x => x.Administrator)
|
||||
.Where(x => x.RoomNumber == model.RoomNumber)
|
||||
.ToList()
|
||||
@ -106,10 +94,7 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.ThenInclude(x => x.ConferenceBookingDinner)
|
||||
.ThenInclude(x => x.ConferenceBooking)
|
||||
.Include(x => x.MealPlanRooms)
|
||||
.ThenInclude(x => x.MealPlan)
|
||||
.ThenInclude(x => x.Participants)
|
||||
.ThenInclude(x => x.Participant)
|
||||
.Include(x => x.MealPlan)
|
||||
.Include(x => x.Administrator)
|
||||
.FirstOrDefault(x => (model.RoomNumber != null && x.RoomNumber == model.RoomNumber) || (model.Id.HasValue && x.Id == model.Id));
|
||||
|
||||
@ -134,10 +119,7 @@ namespace HotelDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Dinner)
|
||||
.ThenInclude(x => x.ConferenceBookingDinner)
|
||||
.ThenInclude(x => x.ConferenceBooking)
|
||||
.Include(x => x.MealPlanRooms)
|
||||
.ThenInclude(x => x.MealPlan)
|
||||
.ThenInclude(x => x.Participants)
|
||||
.ThenInclude(x => x.Participant)
|
||||
.Include(x => x.MealPlan)
|
||||
.Include(x => x.Administrator)
|
||||
.FirstOrDefault(x => x.Id == newRoom.Id)
|
||||
?.GetViewModel;
|
||||
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace HotelDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(HotelDataBase))]
|
||||
[Migration("20240501154837_SeqMigration")]
|
||||
partial class SeqMigration
|
||||
[Migration("20240501171235_DeleteManyMigration")]
|
||||
partial class DeleteManyMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -239,29 +239,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
b.ToTable("MealPlanParticipants");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.MealPlanRoom", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MealPlanId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RoomId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MealPlanId");
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.ToTable("MealPlanRooms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.Organiser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -483,25 +460,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
b.Navigation("Participant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.MealPlanRoom", b =>
|
||||
{
|
||||
b.HasOne("HotelDataBaseImplement.Models.MealPlan", "MealPlan")
|
||||
.WithMany("Rooms")
|
||||
.HasForeignKey("MealPlanId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HotelDataBaseImplement.Models.Room", "Room")
|
||||
.WithMany("MealPlanRooms")
|
||||
.HasForeignKey("RoomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MealPlan");
|
||||
|
||||
b.Navigation("Room");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.Participant", b =>
|
||||
{
|
||||
b.HasOne("HotelDataBaseImplement.Models.Organiser", "Organiser")
|
||||
@ -522,7 +480,7 @@ namespace HotelDataBaseImplement.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HotelDataBaseImplement.Models.MealPlan", "MealPlan")
|
||||
.WithMany()
|
||||
.WithMany("Rooms")
|
||||
.HasForeignKey("MealPlanId");
|
||||
|
||||
b.Navigation("Administrator");
|
||||
@ -603,8 +561,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.Room", b =>
|
||||
{
|
||||
b.Navigation("Dinners");
|
||||
|
||||
b.Navigation("MealPlanRooms");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace HotelDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SeqMigration : Migration
|
||||
public partial class DeleteManyMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@ -265,32 +265,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MealPlanRooms",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RoomId = table.Column<int>(type: "integer", nullable: false),
|
||||
MealPlanId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MealPlanRooms", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MealPlanRooms_MealPlans_MealPlanId",
|
||||
column: x => x.MealPlanId,
|
||||
principalTable: "MealPlans",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_MealPlanRooms_Rooms_RoomId",
|
||||
column: x => x.RoomId,
|
||||
principalTable: "Rooms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RoomDinners",
|
||||
columns: table => new
|
||||
@ -367,16 +341,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
table: "MealPlanParticipants",
|
||||
column: "ParticipantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MealPlanRooms_MealPlanId",
|
||||
table: "MealPlanRooms",
|
||||
column: "MealPlanId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MealPlanRooms_RoomId",
|
||||
table: "MealPlanRooms",
|
||||
column: "RoomId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MealPlans_OrganiserId",
|
||||
table: "MealPlans",
|
||||
@ -420,9 +384,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "MealPlanParticipants");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MealPlanRooms");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RoomDinners");
|
||||
|
@ -236,29 +236,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
b.ToTable("MealPlanParticipants");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.MealPlanRoom", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MealPlanId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RoomId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MealPlanId");
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.ToTable("MealPlanRooms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.Organiser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -480,25 +457,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
b.Navigation("Participant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.MealPlanRoom", b =>
|
||||
{
|
||||
b.HasOne("HotelDataBaseImplement.Models.MealPlan", "MealPlan")
|
||||
.WithMany("Rooms")
|
||||
.HasForeignKey("MealPlanId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HotelDataBaseImplement.Models.Room", "Room")
|
||||
.WithMany("MealPlanRooms")
|
||||
.HasForeignKey("RoomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MealPlan");
|
||||
|
||||
b.Navigation("Room");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.Participant", b =>
|
||||
{
|
||||
b.HasOne("HotelDataBaseImplement.Models.Organiser", "Organiser")
|
||||
@ -519,7 +477,7 @@ namespace HotelDataBaseImplement.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HotelDataBaseImplement.Models.MealPlan", "MealPlan")
|
||||
.WithMany()
|
||||
.WithMany("Rooms")
|
||||
.HasForeignKey("MealPlanId");
|
||||
|
||||
b.Navigation("Administrator");
|
||||
@ -600,8 +558,6 @@ namespace HotelDataBaseImplement.Migrations
|
||||
modelBuilder.Entity("HotelDataBaseImplement.Models.Room", b =>
|
||||
{
|
||||
b.Navigation("Dinners");
|
||||
|
||||
b.Navigation("MealPlanRooms");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace HotelDataBaseImplement.Models
|
||||
public virtual List<MealPlanParticipant> Participants { get; set; } = new();
|
||||
|
||||
[ForeignKey("MealPlanId")]
|
||||
public virtual List<MealPlanRoom> Rooms { get; set; } = new();
|
||||
public virtual List<Room> Rooms { get; set; } = new();
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, IParticipantModel> MealPlanParticipants
|
||||
|
@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HotelDataBaseImplement.Models
|
||||
{
|
||||
public class MealPlanRoom
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int RoomId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int MealPlanId { get; set; }
|
||||
|
||||
public virtual MealPlan MealPlan { get; set; } = new();
|
||||
public virtual Room Room { get; set; } = new();
|
||||
}
|
||||
}
|
@ -19,15 +19,12 @@ namespace HotelDataBaseImplement.Models
|
||||
|
||||
public int AdministratorId { get; private set; }
|
||||
public int? MealPlanId { get; private set; }
|
||||
public virtual Administrator Administrator { get; set; }
|
||||
public virtual Administrator? Administrator { get; set; }
|
||||
public virtual MealPlan? MealPlan { get; set; }
|
||||
|
||||
[ForeignKey("RoomId")]
|
||||
public virtual List<RoomDinner> Dinners { get; set; } = new();
|
||||
|
||||
[ForeignKey("RoomId")]
|
||||
public virtual List<MealPlanRoom> MealPlanRooms { get; set; }
|
||||
|
||||
private Dictionary<int, IDinnerModel> _roomDinners = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IDinnerModel> RoomDinners
|
||||
|
Loading…
x
Reference in New Issue
Block a user