61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
|
namespace Landmark.OLA.Models.Loan
|
|
{
|
|
[BsonIgnoreExtraElements]
|
|
public class DealershipAuthRequest
|
|
{
|
|
[Required]
|
|
public string DealershipCode { get; set; }
|
|
|
|
public string DealershipName { get; set; }
|
|
|
|
[Required]
|
|
public string DealershipPassword { get; set; }
|
|
|
|
[Required]
|
|
public string ApplicantLastName { get; set; }
|
|
|
|
[Required]
|
|
public string ApplicationId { get; set; }
|
|
|
|
public DealershipAuthRequest(string dealershipCode, string dealershipName, string dealershipPassword, string applicantLastName, string applicationId)
|
|
{
|
|
this.DealershipCode = dealershipCode;
|
|
this.DealershipName = dealershipName;
|
|
this.DealershipPassword = dealershipPassword;
|
|
this.ApplicantLastName = applicantLastName;
|
|
this.ApplicationId = applicationId;
|
|
}
|
|
|
|
public static bool ValidateAuthRequest(DealershipAuthRequest dealershipRequest, DealershipAuthRequest actionResponse)
|
|
{
|
|
return dealershipRequest?.Equals(actionResponse) ?? false;
|
|
}
|
|
|
|
public override bool Equals(Object authRequest)
|
|
{
|
|
if (authRequest is not DealershipAuthRequest request)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return string.Equals(DealershipCode, request.DealershipCode, StringComparison.Ordinal) &&
|
|
string.Equals(DealershipPassword, request.DealershipPassword, StringComparison.Ordinal) &&
|
|
string.Equals(ApplicantLastName, request.ApplicantLastName, StringComparison.OrdinalIgnoreCase) &&
|
|
string.Equals(ApplicationId, request.ApplicationId, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(
|
|
DealershipCode?.ToUpperInvariant(),
|
|
DealershipPassword,
|
|
ApplicantLastName?.ToUpperInvariant(),
|
|
ApplicationId?.ToUpperInvariant()
|
|
);
|
|
}
|
|
}
|
|
}
|