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/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 new file mode 100644 index 0000000..0a701e4 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/Dinner.cs @@ -0,0 +1,32 @@ +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; + +namespace HotelDataBaseImplement.Models +{ + public class Dinner : IDinnerModel + { + public int Id { get; set; } + public int HeadwaiterId { get; set; } + + [Required] + public string DinnerName { get; set; } = string.Empty; + + [Required] + public double DinnetPrice { get; set; } + + public virtual Headwaiter Headwaiters { get; set; } + + [ForeignKey("DinnerId")] + public virtual List RoomDinners { get; set; } + + [ForeignKey("DinnercId")] + public virtual List ConferenceBookingDinners { get; set; } + + } +} diff --git a/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs new file mode 100644 index 0000000..9d0f370 --- /dev/null +++ b/Hotel/HotelDataBaseImplement/Models/Headwaiter.cs @@ -0,0 +1,93 @@ +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; + +namespace HotelDataBaseImplement.Models +{ + public class Headwaiter : IHeadwaiterModel + { + public int Id { get; private set; } + + [Required] + public string HeadwaiterFIO { get; set; } = string.Empty; + + [Required] + public string HeadwaiterEmail { get; set; } = string.Empty; + + [Required] + public string HeadwaiterPassword { get; set; } = string.Empty; + + [Required] + public string HeadwaiterLogin { get; set; } = string.Empty; + + [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; + } + 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 + }; + + } +} 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(); + } +} 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; } + } +}