commit specia for 8
This commit is contained in:
commit
62f4064fce
@ -3,58 +3,66 @@ using MotorPlantContracts.ViewModels;
|
|||||||
using MotorPlantDataModels.Models;
|
using MotorPlantDataModels.Models;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace MotorPlantDatabaseImplement.Models
|
namespace MotorPlantDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
public class MessageInfo : IMessageInfoModel
|
public class MessageInfo : IMessageInfoModel
|
||||||
{
|
{
|
||||||
|
[NotMapped]
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
public virtual Client? Client { get; set; }
|
public virtual Client? Client { get; set; }
|
||||||
|
|
||||||
[Required]
|
[DataMember]
|
||||||
public string SenderName { get; set; } = string.Empty;
|
[Required]
|
||||||
|
public string SenderName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
[DataMember]
|
||||||
public DateTime DateDelivery { get; set; }
|
[Required]
|
||||||
|
public DateTime DateDelivery { get; set; }
|
||||||
|
|
||||||
[Required]
|
[DataMember]
|
||||||
public string Subject { get; set; } = string.Empty;
|
[Required]
|
||||||
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
[DataMember]
|
||||||
public string Body { get; set; } = string.Empty;
|
[Required]
|
||||||
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
public static MessageInfo? Create(MessageInfoBindingModel? model)
|
public static MessageInfo? Create(MessageInfoBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
MessageId = model.MessageId,
|
MessageId = model.MessageId,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
SenderName = model.SenderName,
|
SenderName = model.SenderName,
|
||||||
DateDelivery = model.DateDelivery,
|
DateDelivery = model.DateDelivery,
|
||||||
Subject = model.Subject,
|
Subject = model.Subject,
|
||||||
Body = model.Body,
|
Body = model.Body,
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageInfoViewModel GetViewModel => new()
|
public MessageInfoViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
MessageId = MessageId,
|
MessageId = MessageId,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
SenderName = SenderName,
|
SenderName = SenderName,
|
||||||
DateDelivery = DateDelivery,
|
DateDelivery = DateDelivery,
|
||||||
Subject = Subject,
|
Subject = Subject,
|
||||||
Body = Body
|
Body = Body
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user