50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using BeautySalonContracts.BindingModels;
|
|
using BeautySalonDataModels.Models;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace BeautySalonDatabaseImplement.Models
|
|
{
|
|
public class Visit : IVisitModel
|
|
{
|
|
public int Id { get; private set; }
|
|
[Required]
|
|
public DateTime DateOfVisit { get; private set; }
|
|
[Required]
|
|
public int ClientId { get; private set; }
|
|
public int MasterId { get; private set; }
|
|
public int ServiceId { get; private set; }
|
|
public string ClientFIO { get; set; } = string.Empty;
|
|
public string MasterFIO { get; set; } = string.Empty;
|
|
public string ServiceName { get; set; } = string.Empty;
|
|
[Required]
|
|
public double Sum { get; private set; }
|
|
[Required]
|
|
public int Count { get; private set; }
|
|
public virtual Client Client { get; set; }
|
|
public virtual Master Master { get; set; }
|
|
public virtual Service Service { get; set; }
|
|
|
|
public static Visit? Create(VisitBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new Visit()
|
|
{
|
|
Id = model.Id,
|
|
MasterId = model.MasterId,
|
|
ClientId = model.ClientId,
|
|
ServiceId = model.ServiceId,
|
|
MasterFIO = model.MasterFIO,
|
|
ClientFIO = model.ClientFIO,
|
|
ServiceName = model.ServiceName,
|
|
Count = model.Count,
|
|
Sum = model.Sum,
|
|
DateOfVisit = model.DateOfVisit
|
|
};
|
|
}
|
|
}
|
|
}
|