Merge branch 'CourseWork' of http://student.git.athene.tech/AnnZhimol/CourseWork_Hotel into CourseWork
This commit is contained in:
commit
607a268bef
18
Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs
Normal file
18
Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
32
Hotel/HotelDataBaseImplement/Models/Dinner.cs
Normal file
32
Hotel/HotelDataBaseImplement/Models/Dinner.cs
Normal file
@ -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<RoomDinner> RoomDinners { get; set; }
|
||||
|
||||
[ForeignKey("DinnercId")]
|
||||
public virtual List<ConferenceBookingDinner> ConferenceBookingDinners { get; set; }
|
||||
|
||||
}
|
||||
}
|
93
Hotel/HotelDataBaseImplement/Models/Headwaiter.cs
Normal file
93
Hotel/HotelDataBaseImplement/Models/Headwaiter.cs
Normal file
@ -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<Room> Rooms { get; set; } = new();
|
||||
|
||||
[ForeignKey("HeadwaiterId")]
|
||||
public virtual List<Dinner> Dinners { get; set; } = new();
|
||||
|
||||
[ForeignKey("HeadwaiterId")]
|
||||
public virtual List<ConferenceBooking> 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
|
||||
};
|
||||
|
||||
}
|
||||
}
|
24
Hotel/HotelDataBaseImplement/Models/Room.cs
Normal file
24
Hotel/HotelDataBaseImplement/Models/Room.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
21
Hotel/HotelDataBaseImplement/Models/RoomDinner.cs
Normal file
21
Hotel/HotelDataBaseImplement/Models/RoomDinner.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user