From 90ae47140d1b9abb0fa9a04399420c4237471219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Sun, 2 Apr 2023 14:51:29 +0400 Subject: [PATCH 1/5] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B5=D0=B9=20=D0=B2=20?= =?UTF-8?q?DataBaseImplement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/ConferenceBooking.cs | 18 ++++++++++++++ Hotel/HotelDataBaseImplement/Models/Dinner.cs | 20 ++++++++++++++++ .../Models/Headwaiter.cs | 24 +++++++++++++++++++ Hotel/HotelDataBaseImplement/Models/Room.cs | 24 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs create mode 100644 Hotel/HotelDataBaseImplement/Models/Dinner.cs create mode 100644 Hotel/HotelDataBaseImplement/Models/Headwaiter.cs create mode 100644 Hotel/HotelDataBaseImplement/Models/Room.cs diff --git a/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs b/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs new file mode 100644 index 0000000..92ed100 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs @@ -0,0 +1,18 @@ +using HotelDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HotelDataBaseImplement.Models +{ + public class ConferenceBooking : IConferenceBookingModel + { + public int HeadwaiterId => throw new NotImplementedException(); + + public int ConferenceId => throw new NotImplementedException(); + + public int Id => throw new NotImplementedException(); + } +} diff --git a/Hotel/HotelDataBaseImplement/Models/Dinner.cs b/Hotel/HotelDataBaseImplement/Models/Dinner.cs new file mode 100644 index 0000000..b053fdb --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/Dinner.cs @@ -0,0 +1,20 @@ +using HotelDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HotelDataBaseImplement.Models +{ + public class Dinner : IDinnerModel + { + public string DinnerName => throw new NotImplementedException(); + + public double DinnetPrice => throw new NotImplementedException(); + + public int HeadwaiterId => throw new NotImplementedException(); + + public int Id => throw new NotImplementedException(); + } +} diff --git a/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs new file mode 100644 index 0000000..0e6f1a0 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs @@ -0,0 +1,24 @@ +using HotelDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HotelDataBaseImplement.Models +{ + public class Headwaiter : IHeadwaiterModel + { + public string HeadwaiterFIO => throw new NotImplementedException(); + + public string HeadwaiterPassword => throw new NotImplementedException(); + + public string HeadwaiterLogin => throw new NotImplementedException(); + + public string HeadwaiterEmail => throw new NotImplementedException(); + + public string HeadwaiterNumber => throw new NotImplementedException(); + + public int Id => throw new NotImplementedException(); + } +} diff --git a/Hotel/HotelDataBaseImplement/Models/Room.cs b/Hotel/HotelDataBaseImplement/Models/Room.cs new file mode 100644 index 0000000..bf6d882 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/Room.cs @@ -0,0 +1,24 @@ +using HotelDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HotelDataBaseImplement.Models +{ + public class Room : IRoomModel + { + public string RoomName => throw new NotImplementedException(); + + public string RoomFrame => throw new NotImplementedException(); + + public double RoomPrice => throw new NotImplementedException(); + + public int HeadwaiterId => throw new NotImplementedException(); + + public int MealPlanId => throw new NotImplementedException(); + + public int Id => throw new NotImplementedException(); + } +} From 78f2162efe30d241482287a41c79e75ea5fc33f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Sun, 2 Apr 2023 15:07:36 +0400 Subject: [PATCH 2/5] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8=20Hea?= =?UTF-8?q?dwaiter=20=D0=B2=20DataBaseImplement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Headwaiter.cs | 84 +++++++++++++++++-- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs index 0e6f1a0..202843c 100644 --- a/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs +++ b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs @@ -1,6 +1,10 @@ -using HotelDataModels.Models; +using HotelContracts.BindingModels; +using HotelContracts.ViewModels; +using HotelDataModels.Models; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,16 +13,82 @@ namespace HotelDataBaseImplement.Models { public class Headwaiter : IHeadwaiterModel { - public string HeadwaiterFIO => throw new NotImplementedException(); + public int Id { get; private set; } + + [Required] + public string HeadwaiterFIO { get; set; } = string.Empty; - public string HeadwaiterPassword => throw new NotImplementedException(); + [Required] + public string HeadwaiterEmail { get; set; } = string.Empty; - public string HeadwaiterLogin => throw new NotImplementedException(); + [Required] + public string HeadwaiterPassword { get; set; } = string.Empty; - public string HeadwaiterEmail => throw new NotImplementedException(); + [Required] + public string HeadwaiterLogin { get; set; } = string.Empty; - public string HeadwaiterNumber => throw new NotImplementedException(); + [Required] + public string HeadwaiterNumber { get; set; } = string.Empty; + + + [ForeignKey("HeadwaiterId")] + public virtual List Rooms { get; set; } = new(); + + [ForeignKey("HeadwaiterId")] + public virtual List Dinners { get; set; } = new(); + + [ForeignKey("HeadwaiterId")] + public virtual List ConferenceBookings { get; set; } = new(); + public static Headwaiter? Create(HeadwaiterBindingModel model) + { + if (model == null) + { + return null; + } + return new Headwaiter() + { + Id = model.Id, + HeadwaiterFIO = model.HeadwaiterFIO, + HeadwaiterEmail = model.HeadwaiterEmail, + HeadwaiterPassword = model.HeadwaiterPassword, + HeadwaiterLogin = model.HeadwaiterLogin, + HeadwaiterNumber = model.HeadwaiterNumber + }; + } + public static Headwaiter Create(HeadwaiterViewModel model) + { + return new Headwaiter + { + Id = model.Id, + HeadwaiterFIO = model.HeadwaiterFIO, + HeadwaiterEmail = model.HeadwaiterEmail, + HeadwaiterPassword = model.HeadwaiterPassword, + HeadwaiterLogin = model.HeadwaiterLogin, + HeadwaiterNumber = model.HeadwaiterNumber + }; + } + public void Update(HeadwaiterBindingModel model) + { + if (model == null) + { + return; + } + Id = model.Id; + HeadwaiterFIO = model.HeadwaiterFIO; + HeadwaiterEmail = model.HeadwaiterEmail; + HeadwaiterPassword = model.HeadwaiterPassword; + HeadwaiterLogin = model.HeadwaiterLogin; + HeadwaiterNumber = model.HeadwaiterNumber; + } + public HeadwaiterViewModel GetViewModel => new() + { + Id = Id, + HeadwaiterFIO = HeadwaiterFIO, + HeadwaiterEmail = HeadwaiterEmail, + HeadwaiterPassword = HeadwaiterPassword, + HeadwaiterLogin = HeadwaiterLogin, + HeadwaiterNumber = HeadwaiterNumber + }; - public int Id => throw new NotImplementedException(); } } From f1eebab894870412293b3313243382d8be46f5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Sun, 2 Apr 2023 15:10:36 +0400 Subject: [PATCH 3/5] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20Headwaiter=20=D0=B2=20DataBaseImplem?= =?UTF-8?q?ent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hotel/HotelDataBaseImplement/Models/Headwaiter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs index 202843c..9d0f370 100644 --- a/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs +++ b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs @@ -73,7 +73,6 @@ namespace HotelDataBaseImplement.Models { return; } - Id = model.Id; HeadwaiterFIO = model.HeadwaiterFIO; HeadwaiterEmail = model.HeadwaiterEmail; HeadwaiterPassword = model.HeadwaiterPassword; From c10db2e6334e40bc3a3a85d2c0f4e910e5993bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Sun, 2 Apr 2023 15:27:07 +0400 Subject: [PATCH 4/5] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20Dinner=20=D0=B2=20DataBaseImplement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hotel/HotelDataBaseImplement/Models/Dinner.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Hotel/HotelDataBaseImplement/Models/Dinner.cs b/Hotel/HotelDataBaseImplement/Models/Dinner.cs index b053fdb..feb3413 100644 --- a/Hotel/HotelDataBaseImplement/Models/Dinner.cs +++ b/Hotel/HotelDataBaseImplement/Models/Dinner.cs @@ -1,6 +1,8 @@ using HotelDataModels.Models; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,12 +11,22 @@ namespace HotelDataBaseImplement.Models { public class Dinner : IDinnerModel { - public string DinnerName => throw new NotImplementedException(); + public int Id { get; set; } + public int HeadwaiterId { get; set; } - public double DinnetPrice => throw new NotImplementedException(); + [Required] + public string DinnerName { get; set; } = string.Empty; - public int HeadwaiterId => throw new NotImplementedException(); + [Required] + public double DinnetPrice { get; set; } + + public virtual Headwaiter Headwaiter { get; set; } + + [ForeignKey("DinnerId")] + public virtual List RoomHeadwaiters { get; set; } + + [ForeignKey("DinnercId")] + public virtual List ConferenceBookingHeadwaites { get; set; } - public int Id => throw new NotImplementedException(); } } From 257e7b3b4dc2e93f4120bc158561f3fd8c63a2d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Sun, 2 Apr 2023 15:45:08 +0400 Subject: [PATCH 5/5] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20Dinner.=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20RoomDinner?= =?UTF-8?q?=20=D0=B8=20ConferenceBookingDinner=20=D0=B2=20DataBaseImplemen?= =?UTF-8?q?t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/ConferenceBookingDinner.cs | 21 +++++++++++++++++++ Hotel/HotelDataBaseImplement/Models/Dinner.cs | 6 +++--- .../Models/RoomDinner.cs | 21 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 Hotel/HotelDataBaseImplement/Models/ConferenceBookingDinner.cs create mode 100644 Hotel/HotelDataBaseImplement/Models/RoomDinner.cs diff --git a/Hotel/HotelDataBaseImplement/Models/ConferenceBookingDinner.cs b/Hotel/HotelDataBaseImplement/Models/ConferenceBookingDinner.cs new file mode 100644 index 0000000..fe57745 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/ConferenceBookingDinner.cs @@ -0,0 +1,21 @@ +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 ConferenceBookingDinner + { + public int Id { get; set; } + public int ConferenceBookingId { get; set; } + public int DinnerId { get; set; } + + [Required] + public int Count { get; set; } + public virtual ConferenceBooking ConferenceBookings { get; set; } + public virtual Dinner Dinners { get; set; } + } +} diff --git a/Hotel/HotelDataBaseImplement/Models/Dinner.cs b/Hotel/HotelDataBaseImplement/Models/Dinner.cs index feb3413..0a701e4 100644 --- a/Hotel/HotelDataBaseImplement/Models/Dinner.cs +++ b/Hotel/HotelDataBaseImplement/Models/Dinner.cs @@ -20,13 +20,13 @@ namespace HotelDataBaseImplement.Models [Required] public double DinnetPrice { get; set; } - public virtual Headwaiter Headwaiter { get; set; } + public virtual Headwaiter Headwaiters { get; set; } [ForeignKey("DinnerId")] - public virtual List RoomHeadwaiters { get; set; } + public virtual List RoomDinners { get; set; } [ForeignKey("DinnercId")] - public virtual List ConferenceBookingHeadwaites { get; set; } + public virtual List ConferenceBookingDinners { get; set; } } } diff --git a/Hotel/HotelDataBaseImplement/Models/RoomDinner.cs b/Hotel/HotelDataBaseImplement/Models/RoomDinner.cs new file mode 100644 index 0000000..95e71b8 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/RoomDinner.cs @@ -0,0 +1,21 @@ +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 RoomDinner + { + public int Id { get; set; } + public int RoomId { get; set; } + public int DinnerId { get; set; } + + [Required] + public int Count { get; set; } + public virtual Room Rooms { get; set; } + public virtual Dinner Dinners { get; set; } + } +}