From a4b1a25cedb16a7759cb54a07091c495aa0d334b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 14 May 2025 15:17:05 +0530 Subject: [PATCH] Models, DTOs (Data Transfer Objects), and view models have been created for the directory. --- Marco.Pms.Model/Directory/Bucket.cs | 11 ++ Marco.Pms.Model/Directory/Contact.cs | 31 +++ .../Directory/ContactBucketMapping.cs | 18 ++ .../Directory/ContactCategoryMaster.cs | 11 ++ Marco.Pms.Model/Directory/ContactEmail.cs | 21 +++ Marco.Pms.Model/Directory/ContactNote.cs | 25 +++ Marco.Pms.Model/Directory/ContactPhone.cs | 22 +++ .../Directory/ContactTagMapping.cs | 11 ++ Marco.Pms.Model/Directory/ContactTagMaster.cs | 11 ++ .../Directory/DirectoryUpdateLog.cs | 18 ++ .../Directory/EmployeeBucketMapping.cs | 19 ++ .../Dtos/Directory/CreateBucketDto.cs | 8 + .../Dtos/Directory/CreateContactDto.cs | 15 ++ .../Dtos/Directory/CreateContactEmailDto.cs | 9 + .../Dtos/Directory/CreateContactNoteDto.cs | 8 + .../Dtos/Directory/CreateContactPhoneDto.cs | 9 + .../Dtos/Directory/UpdateContactDto.cs | 16 ++ .../Dtos/Directory/UpdateContactEmailDto.cs | 10 + .../Dtos/Directory/UpdateContactNoteDto.cs | 9 + .../Dtos/Directory/UpdateContactPhoneDto.cs | 10 + .../Dtos/Master/CreateContactCategoryDto.cs | 8 + .../Dtos/Master/CreateContactTagDto.cs | 7 + .../Dtos/Master/UpdateContactCategoryDto.cs | 9 + .../Dtos/Master/UpdateContactTagDto.cs | 8 + Marco.Pms.Model/Mapper/DirectoryMapper.cs | 177 ++++++++++++++++++ .../ViewModels/Directory/ContactEmailVM.cs | 10 + .../ViewModels/Directory/ContactPhoneVM.cs | 10 + .../ViewModels/Directory/ContactVM.cs | 18 ++ .../ViewModels/Master/ContactCategoryVM.cs | 9 + .../ViewModels/Master/ContactTagVM.cs | 8 + 30 files changed, 556 insertions(+) create mode 100644 Marco.Pms.Model/Directory/Bucket.cs create mode 100644 Marco.Pms.Model/Directory/Contact.cs create mode 100644 Marco.Pms.Model/Directory/ContactBucketMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactCategoryMaster.cs create mode 100644 Marco.Pms.Model/Directory/ContactEmail.cs create mode 100644 Marco.Pms.Model/Directory/ContactNote.cs create mode 100644 Marco.Pms.Model/Directory/ContactPhone.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMapping.cs create mode 100644 Marco.Pms.Model/Directory/ContactTagMaster.cs create mode 100644 Marco.Pms.Model/Directory/DirectoryUpdateLog.cs create mode 100644 Marco.Pms.Model/Directory/EmployeeBucketMapping.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs create mode 100644 Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs create mode 100644 Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs create mode 100644 Marco.Pms.Model/Mapper/DirectoryMapper.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Directory/ContactVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs create mode 100644 Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs new file mode 100644 index 0000000..028b428 --- /dev/null +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class Bucket : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs new file mode 100644 index 0000000..87d7698 --- /dev/null +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class Contact : TenantRelation + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string Organization { get; set; } = string.Empty; + public string? Address { get; set; } + public bool IsActive { get; set; } = true; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? CreatedBy { get; set; } + + [DisplayName("ContactCategoryId")] + public Guid? ContactCategoryId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactCategoryId))] + public ContactCategoryMaster? ContactCategory { get; set; } + public DateTime CreatedAt { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactBucketMapping.cs b/Marco.Pms.Model/Directory/ContactBucketMapping.cs new file mode 100644 index 0000000..9444337 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactBucketMapping.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactCategoryMaster.cs b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs new file mode 100644 index 0000000..8fb1a94 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactCategoryMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactCategoryMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/ContactEmail.cs b/Marco.Pms.Model/Directory/ContactEmail.cs new file mode 100644 index 0000000..1eb1b34 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactEmail.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactEmail + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string EmailAddress { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactNote.cs b/Marco.Pms.Model/Directory/ContactNote.cs new file mode 100644 index 0000000..e203f1d --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactNote.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactNote : TenantRelation + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid CreatedById { get; set; } + + [ValidateNever] + [ForeignKey("CreatedById")] + public Employee? Createdby { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public Guid ContactId { get; set; } + + [ValidateNever] + [ForeignKey("ContactId")] + public Contact? Contact { get; set; } + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Directory/ContactPhone.cs b/Marco.Pms.Model/Directory/ContactPhone.cs new file mode 100644 index 0000000..d10439b --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactPhone.cs @@ -0,0 +1,22 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class ContactPhone + { + public Guid Id { get; set; } + public string Label { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + [DisplayName("ContactId")] + public Guid ContactId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ContactId))] + public Contact? Contact { get; set; } + public bool IsPrimary { get; set; } + + public Guid TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs new file mode 100644 index 0000000..a3d7e9e --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMapping + { + public Guid Id { get; set; } + public Guid ContactId { get; set; } + public Contact? Contact { get; set; } + public Guid ContactTagtId { get; set; } + public ContactTagMaster? ContactTag { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/ContactTagMaster.cs b/Marco.Pms.Model/Directory/ContactTagMaster.cs new file mode 100644 index 0000000..86eba76 --- /dev/null +++ b/Marco.Pms.Model/Directory/ContactTagMaster.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Directory +{ + public class ContactTagMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs new file mode 100644 index 0000000..91b1b7a --- /dev/null +++ b/Marco.Pms.Model/Directory/DirectoryUpdateLog.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class DirectoryUpdateLog + { + public Guid Id { get; set; } + public Guid RefereanceId { get; set; } + public DateTime UpdateAt { get; set; } = DateTime.UtcNow; + public Guid UpdatedById { get; set; } + + [ValidateNever] + [ForeignKey("UpdatedById")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs new file mode 100644 index 0000000..db12d3f --- /dev/null +++ b/Marco.Pms.Model/Directory/EmployeeBucketMapping.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Directory +{ + public class EmployeeBucketMapping + { + public Guid Id { get; set; } + public Guid BucketId { get; set; } + [ValidateNever] + [ForeignKey("BucketId")] + public Bucket? Bucket { get; set; } + public Guid EmployeeId { get; set; } + [ValidateNever] + [ForeignKey("EmployeeId")] + public Employee? Employee { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs new file mode 100644 index 0000000..ba0918d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateBucketDto + { + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs new file mode 100644 index 0000000..42937c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -0,0 +1,15 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactDto + { + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs new file mode 100644 index 0000000..68bb2b2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactEmailDto + { + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs new file mode 100644 index 0000000..1ccaea9 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactNoteDto + { + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs new file mode 100644 index 0000000..dc97881 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class CreateContactPhoneDto + { + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs new file mode 100644 index 0000000..042150d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -0,0 +1,16 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactDto + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public Guid ContactCategoryId { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? TagIds { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs new file mode 100644 index 0000000..8ece036 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactEmailDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs new file mode 100644 index 0000000..295357a --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactNoteDto + { + public Guid Id { get; set; } + public string Note { get; set; } = string.Empty; + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs new file mode 100644 index 0000000..1ddfb14 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Directory +{ + public class UpdateContactPhoneDto + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs new file mode 100644 index 0000000..3efc443 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactCategoryDto + { + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs new file mode 100644 index 0000000..ad91ca7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class CreateContactTagDto + { + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs new file mode 100644 index 0000000..0bd5cc7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactCategoryDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs new file mode 100644 index 0000000..0406a6c --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class UpdateContactTagDto + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs new file mode 100644 index 0000000..048a0d2 --- /dev/null +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -0,0 +1,177 @@ +using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Directory; +using Marco.Pms.Model.Dtos.Master; +using Marco.Pms.Model.ViewModels.Directory; +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.Mapper +{ + public static class DirectoryMapper + { + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) + { + + return new Contact + { + ProjectId = createContactDto.ProjectId, + Name = createContactDto.Name ?? string.Empty, + ContactCategoryId = createContactDto.ContactCategoryId, + Description = createContactDto.Description ?? string.Empty, + Organization = createContactDto?.Organization ?? string.Empty, + Address = createContactDto != null ? createContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) + { + + return new Contact + { + Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, + Name = updateContactDto.Name ?? string.Empty, + ContactCategoryId = updateContactDto.ContactCategoryId, + Description = updateContactDto.Description ?? string.Empty, + Organization = updateContactDto?.Organization ?? string.Empty, + Address = updateContactDto != null ? updateContactDto.Address : string.Empty, + TenantId = tenantId + }; + } + public static ContactVM ToContactVMFromContact(this Contact contact) + { + return new ContactVM + { + Id = contact.Id, + ProjectId = contact.ProjectId, + Name = contact.Name, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), + Description = contact.Description ?? string.Empty, + Organization = contact.Organization ?? string.Empty, + Address = contact.Address ?? string.Empty + }; + } + + //Contact Phone Mapper + public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Label = createContactPhoneDto.Label ?? string.Empty, + PhoneNumber = createContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhone ToContactPhoneFromUpdateContactPhoneDto(this UpdateContactPhoneDto updateContactPhoneDto, Guid tenantId, Guid contactId) + { + return new ContactPhone + { + Id = updateContactPhoneDto.Id, + Label = updateContactPhoneDto.Label ?? string.Empty, + PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactPhoneVM ToContactPhoneVMFromContactPhone(this ContactPhone phone) + { + return new ContactPhoneVM + { + Id = phone.Id, + Label = phone.Label ?? string.Empty, + PhoneNumber = phone.PhoneNumber ?? string.Empty, + ContactId = phone.ContactId + }; + } + + //Contact Email Mapper + public static ContactEmail ToContactEmailFromCreateContactEmailDto(this CreateContactEmailDto createContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Label = createContactEmailDto.Label ?? string.Empty, + EmailAddress = createContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmail ToContactEmailFromUpdateContactEmailDto(this UpdateContactEmailDto updateContactEmailDto, Guid tenantId, Guid contactId) + { + return new ContactEmail + { + Id = updateContactEmailDto.Id, + Label = updateContactEmailDto.Label ?? string.Empty, + EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, + ContactId = contactId, + TenantId = tenantId + }; + } + public static ContactEmailVM ToContactEmailVMFromContactEmail(this ContactEmail email) + { + return new ContactEmailVM + { + Id = email.Id, + Label = email.Label ?? string.Empty, + EmailAddress = email.EmailAddress ?? string.Empty, + ContactId = email.ContactId + }; + } + + //Contact Tag Mapper + public static ContactTagMaster ToContactTagMasterFromCreateContactTagDto(this CreateContactTagDto createContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Name = createContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagMaster ToContactTagMasterFromUpdateContactTagDto(this UpdateContactTagDto updateContactTagDto, Guid tenantId) + { + return new ContactTagMaster + { + Id = updateContactTagDto.Id, + Name = updateContactTagDto.Name ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactTagVM ToContactTagVMFromContactTagMaster(this ContactTagMaster contactTag) + { + return new ContactTagVM + { + Id = contactTag.Id, + Name = contactTag.Name ?? string.Empty, + }; + } + + //Contact Category Mapper + public static ContactCategoryMaster ToContactCategoryMasterFromCreateContactCategoryDto(this CreateContactCategoryDto createContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Name = createContactTypeDto.Name ?? string.Empty, + Description = createContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryMaster ToContactCategoryMasterFromUpdateContactCategoryDto(this UpdateContactCategoryDto updateContactTypeDto, Guid tenantId) + { + return new ContactCategoryMaster + { + Id = updateContactTypeDto.Id, + Name = updateContactTypeDto.Name ?? string.Empty, + Description = updateContactTypeDto.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ContactCategoryVM ToContactCategoryVMFromContactCategoryMaster(this ContactCategoryMaster contactType) + { + return new ContactCategoryVM + { + Id = contactType.Id, + Name = contactType.Name ?? string.Empty, + Description = contactType.Description ?? string.Empty, + }; + } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs new file mode 100644 index 0000000..476e44d --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactEmailVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? EmailAddress { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs new file mode 100644 index 0000000..1dc7672 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactPhoneVM + { + public Guid Id { get; set; } + public string? Label { get; set; } + public string? PhoneNumber { get; set; } + public Guid ContactId { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs new file mode 100644 index 0000000..6d6f82e --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.ViewModels.Master; + +namespace Marco.Pms.Model.ViewModels.Directory +{ + public class ContactVM + { + public Guid Id { get; set; } + public Guid? ProjectId { get; set; } + public string? Name { get; set; } + public List? ContactPhones { get; set; } + public List? ContactEmails { get; set; } + public ContactCategoryVM? ContactType { get; set; } + public string? Description { get; set; } + public string? Organization { get; set; } + public string? Address { get; set; } + public List? Tags { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs new file mode 100644 index 0000000..eb08d89 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactCategoryVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs new file mode 100644 index 0000000..2cb6f8a --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ContactTagVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + } +}