This commit is contained in:
AnnZhimol 2023-04-02 16:19:45 +04:00
commit 607a268bef
6 changed files with 209 additions and 0 deletions

View 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();
}
}

View 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 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; }
}
}

View 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; }
}
}

View 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
};
}
}

View 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();
}
}

View 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; }
}
}