Models, DTOs (Data Transfer Objects), and view models have been created for the directory.
This commit is contained in:
parent
ba92a3b3ed
commit
2cb283f1cd
11
Marco.Pms.Model/Directory/Bucket.cs
Normal file
11
Marco.Pms.Model/Directory/Bucket.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
31
Marco.Pms.Model/Directory/Contact.cs
Normal file
31
Marco.Pms.Model/Directory/Contact.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
18
Marco.Pms.Model/Directory/ContactBucketMapping.cs
Normal file
18
Marco.Pms.Model/Directory/ContactBucketMapping.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
11
Marco.Pms.Model/Directory/ContactCategoryMaster.cs
Normal file
11
Marco.Pms.Model/Directory/ContactCategoryMaster.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
21
Marco.Pms.Model/Directory/ContactEmail.cs
Normal file
21
Marco.Pms.Model/Directory/ContactEmail.cs
Normal file
@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
25
Marco.Pms.Model/Directory/ContactNote.cs
Normal file
25
Marco.Pms.Model/Directory/ContactNote.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
22
Marco.Pms.Model/Directory/ContactPhone.cs
Normal file
22
Marco.Pms.Model/Directory/ContactPhone.cs
Normal file
@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Marco.Pms.Model/Directory/ContactTagMapping.cs
Normal file
11
Marco.Pms.Model/Directory/ContactTagMapping.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
11
Marco.Pms.Model/Directory/ContactTagMaster.cs
Normal file
11
Marco.Pms.Model/Directory/ContactTagMaster.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
18
Marco.Pms.Model/Directory/DirectoryUpdateLog.cs
Normal file
18
Marco.Pms.Model/Directory/DirectoryUpdateLog.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
19
Marco.Pms.Model/Directory/EmployeeBucketMapping.cs
Normal file
19
Marco.Pms.Model/Directory/EmployeeBucketMapping.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
8
Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs
Normal file
8
Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
15
Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs
Normal file
15
Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs
Normal file
@ -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<CreateContactPhoneDto>? ContactPhones { get; set; }
|
||||||
|
public List<CreateContactEmailDto>? 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<Guid>? TagIds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
9
Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
8
Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs
Normal file
8
Marco.Pms.Model/Dtos/Directory/CreateContactNoteDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
9
Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
16
Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs
Normal file
16
Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs
Normal file
@ -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<UpdateContactPhoneDto>? ContactPhones { get; set; }
|
||||||
|
public List<UpdateContactEmailDto>? 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<Guid>? TagIds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
10
Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs
Normal file
10
Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
9
Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Directory/UpdateContactNoteDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
10
Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs
Normal file
10
Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
8
Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs
Normal file
8
Marco.Pms.Model/Dtos/Master/CreateContactCategoryDto.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Marco.Pms.Model.Dtos.Master
|
||||||
|
{
|
||||||
|
public class CreateContactCategoryDto
|
||||||
|
{
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
7
Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs
Normal file
7
Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Marco.Pms.Model.Dtos.Master
|
||||||
|
{
|
||||||
|
public class CreateContactTagDto
|
||||||
|
{
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
9
Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Master/UpdateContactCategoryDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
8
Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs
Normal file
8
Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Marco.Pms.Model.Dtos.Master
|
||||||
|
{
|
||||||
|
public class UpdateContactTagDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
177
Marco.Pms.Model/Mapper/DirectoryMapper.cs
Normal file
177
Marco.Pms.Model/Mapper/DirectoryMapper.cs
Normal file
@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs
Normal file
10
Marco.Pms.Model/ViewModels/Directory/ContactEmailVM.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
10
Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs
Normal file
10
Marco.Pms.Model/ViewModels/Directory/ContactPhoneVM.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
18
Marco.Pms.Model/ViewModels/Directory/ContactVM.cs
Normal file
18
Marco.Pms.Model/ViewModels/Directory/ContactVM.cs
Normal file
@ -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<ContactPhoneVM>? ContactPhones { get; set; }
|
||||||
|
public List<ContactEmailVM>? 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<ContactTagVM>? Tags { get; set; }
|
||||||
|
}
|
||||||
|
}
|
9
Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs
Normal file
9
Marco.Pms.Model/ViewModels/Master/ContactCategoryVM.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
8
Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs
Normal file
8
Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Marco.Pms.Model.ViewModels.Master
|
||||||
|
{
|
||||||
|
public class ContactTagVM
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user