Retructured solution

This commit is contained in:
Khwezi Mngoma
2026-05-13 20:06:24 +02:00
parent 26075cd9a7
commit a42c51d7b2
231 changed files with 1618 additions and 1408 deletions
@@ -0,0 +1,8 @@
namespace LiteCharms.Features.Email.Models;
public class Attachment
{
public string? Name { get; set; }
public Stream? FileStream { get; set; }
}
+26
View File
@@ -0,0 +1,26 @@
namespace LiteCharms.Features.Email.Models;
public class Body : IDisposable
{
public string? Message { get; set; }
public ReadOnlyCollection<Attachment>? Attachments { get; set; }
public BodyProperties Properties { get; set; } = new();
public void Dispose()
{
if (Attachments is null) return;
foreach (var attachment in Attachments!)
{
if (attachment is not null)
{
attachment.FileStream!.Close();
attachment.FileStream!.Dispose();
}
}
GC.SuppressFinalize(this);
}
}
@@ -0,0 +1,8 @@
namespace LiteCharms.Features.Email.Models;
public class BodyProperties
{
public bool IsHtml { get; set; }
public bool HasAttachments { get; set; }
}
@@ -0,0 +1,31 @@
using System.ComponentModel.DataAnnotations;
namespace LiteCharms.Features.Email.Models;
public sealed class EmailEnquiry
{
[Required]
[MinLength(2)]
[MaxLength(255)]
[Display(Name = "Full Name")]
public string? FullName { get; set; }
[Required]
[EmailAddress]
[MinLength(5)]
[MaxLength(255)]
[Display(Name = "Email Address")]
public string? EmailAddress { get; set; }
[Required]
[MinLength(2)]
[MaxLength(255)]
[Display(Name = "Subject")]
public string? EmailSubject { get; set; }
[Required]
[MinLength(2)]
[MaxLength(2000)]
[Display(Name = "Message")]
public string? Message { get; set; }
}
@@ -0,0 +1,19 @@
namespace LiteCharms.Features.Email.Models;
public class Message : IDisposable
{
public Party? Sender { get; set; }
public Party? Recipient { get; set; }
public string? Subject { get; set; }
public Body? Body { get; set; }
public void Dispose()
{
Body?.Dispose();
GC.SuppressFinalize(this);
}
}
@@ -0,0 +1,8 @@
namespace LiteCharms.Features.Email.Models;
public class Party
{
public string? Name { get; set; }
public string? Address { get; set; }
}
@@ -0,0 +1,22 @@
using LiteCharms.Features.Shop;
namespace LiteCharms.Features.Email.Models;
public class Response
{
public int Code { get; set; }
public string? Error { get; set; }
public EmailStatuses Status { get; set; }
private Response(EmailStatuses status, int code = 0, string? error = null)
{
Status = status;
Code = code;
Error = error;
}
public static Response Create(EmailStatuses status, int code = 0, string? error = null) =>
new(status, code, error);
}