You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

using System;
namespace Model
{
public class LargeImage : IEquatable<LargeImage>
{
public string Base64 { get; set; }
public int Id { get; set; }
public LargeImage(int id, string base64)
{
Base64 = base64;
Id = id;
}
public LargeImage(string base64)
{
Base64 = base64;
Id = 0;
}
public bool Equals(LargeImage? other)
{
if (other == null) return false;
if (Id != 0 && other?.Id != 0)
{
return Id == Id;
}
return Base64 == other?.Base64;
}
public override bool Equals(object? obj)
{
if(ReferenceEquals(obj, null)) return false;
if(ReferenceEquals(obj!, this)) return true;
if(GetType() != obj!.GetType()) return false;
return Equals(obj! as LargeImage);
}
public override int GetHashCode()
=> Base64.Substring(0, 10).GetHashCode();
}
}