| | 1 | | using Google.Api.Gax.ResourceNames; |
| | 2 | | using MRA.DTO.Enums.Drawing; |
| | 3 | | using MRA.DTO.Models; |
| | 4 | | using MRA.Infrastructure.Enums; |
| | 5 | |
|
| | 6 | | namespace MRA.DTO.ViewModels.Art.Select |
| | 7 | | { |
| | 8 | | public class CharacterListItem |
| | 9 | | { |
| 21 | 10 | | public string CharacterName { get; set; } |
| 0 | 11 | | public int ProductTypeId { get => (int)ProductType; } |
| 9 | 12 | | public DrawingProductTypes ProductType { get; set; } |
| | 13 | |
|
| 9 | 14 | | public CharacterListItem(string characterName, DrawingProductTypes productType) |
| | 15 | | { |
| 9 | 16 | | CharacterName = characterName; |
| 9 | 17 | | ProductType = productType; |
| 9 | 18 | | } |
| | 19 | |
|
| | 20 | | public static IEnumerable<CharacterListItem> GetCharactersFromDrawings(IEnumerable<DrawingModel> drawings) |
| | 21 | | { |
| 1 | 22 | | return drawings |
| 4 | 23 | | .Where(x => !string.IsNullOrEmpty(x.Name)) |
| 4 | 24 | | .Select(x => new CharacterListItem(x.Name, x.ProductType.ToEnum<DrawingProductTypes>())) |
| 1 | 25 | | .Distinct(); |
| | 26 | | } |
| | 27 | |
|
| | 28 | | public override bool Equals(object obj) |
| | 29 | | { |
| 4 | 30 | | return GetHashCode() == obj.GetHashCode(); |
| | 31 | | } |
| | 32 | |
|
| | 33 | | public override int GetHashCode() |
| | 34 | | { |
| 12 | 35 | | return HashCode.Combine(CharacterName); |
| | 36 | | } |
| | 37 | | } |
| | 38 | | } |