SHA256
GuestLog - StayEntry - Initial Implementation
- Added new entity "StayEntry" to log stays of guests. - Added pages for StayEntry management (List and creation). - New DataList for PaymentMethods. - Other general changes and improvements.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using Somnia.GuestLog.Models.DTOs;
|
||||
using Somnia.GuestLog.Models.Entities;
|
||||
|
||||
namespace Somnia.GuestLog.Models;
|
||||
|
||||
internal static class EntityMapping
|
||||
{
|
||||
|
||||
public static GuestDocumentDTO MapGuestDocumentEntityToDTO(GuestDocument entity)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
DocumentType = entity.DocumentType,
|
||||
DocumentNum = entity.DocumentNum,
|
||||
IssueDate = entity.IssueDate.ToDateTime(TimeOnly.MinValue),
|
||||
SupportNum = entity.SupportNum,
|
||||
Nationality = entity.Nationality,
|
||||
Name = entity.Name,
|
||||
Surname = entity.Surname,
|
||||
Surname2 = entity.Surname2,
|
||||
BirthDate = entity.BirthDate.ToDateTime(TimeOnly.MinValue),
|
||||
Gender = entity.Gender,
|
||||
PhoneNumber = entity.PhoneNumber,
|
||||
EmailAddress = entity.EmailAddress,
|
||||
Address = entity.AddressDetails?.Address ?? "",
|
||||
AddressCity = entity.AddressDetails?.AddressCity ?? "",
|
||||
AddressProvince = entity.AddressDetails?.AddressProvince ?? "",
|
||||
AddressState = entity.AddressDetails?.AddressState ?? "",
|
||||
AddressCountry = entity.AddressDetails?.AddressCountry! ?? "",
|
||||
ZipCode = entity.AddressDetails?.ZipCode ?? "",
|
||||
CreateTime = entity.CreateTime,
|
||||
UpdateTime = entity.UpdateTime,
|
||||
};
|
||||
}
|
||||
|
||||
public static StayEntryDTO MapStayEntryEntityToDTO(StayEntry entity)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
DateIn = entity.DateIn,
|
||||
DateOut = entity.DateOut,
|
||||
RoomCount = entity.RoomCount,
|
||||
RoomNumber = entity.RoomNumber,
|
||||
PaymentMethod = entity.PaymentMethod,
|
||||
CreateTime = entity.CreateTime,
|
||||
UpdateTime = entity.UpdateTime,
|
||||
GuestDocuments = [.. entity.GuestDocuments.Select(e => MapGuestDocumentEntityToDTO(e))],
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user