DocSpace-client/common/ASC.Core.Common/Core/Group.cs

38 lines
944 B
C#
Raw Normal View History

2022-02-15 11:52:43 +00:00
namespace ASC.Core;
public class Group : IMapFrom<DbGroup>
2019-05-15 14:56:09 +00:00
{
2022-02-15 11:52:43 +00:00
public Guid Id { get; set; }
public Guid ParentId { get; set; }
public string Name { get; set; }
public Guid CategoryId { get; set; }
public bool Removed { get; set; }
public DateTime LastModified { get; set; }
public int Tenant { get; set; }
public string Sid { get; set; }
2019-05-15 14:56:09 +00:00
2022-02-15 11:52:43 +00:00
public override string ToString()
{
return Name;
}
2019-05-15 14:56:09 +00:00
2022-02-15 11:52:43 +00:00
public override int GetHashCode()
{
return Id.GetHashCode();
}
2019-05-15 14:56:09 +00:00
2022-02-15 11:52:43 +00:00
public override bool Equals(object obj)
{
return obj is Group g && g.Id == Id;
}
2022-02-15 11:52:43 +00:00
public void Mapping(Profile profile)
{
profile.CreateMap<DbGroup, Group>()
.ForMember(src => src.CategoryId, opt => opt.NullSubstitute(Guid.Empty))
.ForMember(src => src.ParentId, opt => opt.NullSubstitute(Guid.Empty));
2022-02-15 11:52:43 +00:00
profile.CreateMap<GroupInfo, Group>();
2019-05-15 14:56:09 +00:00
}
}