| | 1 | | using Google.Cloud.Firestore; |
| | 2 | | using MRA.DTO.Models.Interfaces; |
| | 3 | | using System; |
| | 4 | | using System.Collections.Generic; |
| | 5 | | using System.Linq; |
| | 6 | | using System.Text; |
| | 7 | | using System.Text.Json.Serialization; |
| | 8 | | using System.Threading.Tasks; |
| | 9 | |
|
| | 10 | | namespace MRA.DTO.Models; |
| | 11 | |
|
| | 12 | | public class CollectionModel : IModel |
| | 13 | | { |
| 54 | 14 | | public string Id { get; set; } |
| 29 | 15 | | public string Name { get; set; } |
| 29 | 16 | | public string Description { get; set; } |
| 17 | 17 | | public int Order { get; set; } |
| | 18 | |
|
| | 19 | | [JsonIgnore] |
| 87 | 20 | | public IEnumerable<DrawingModel> Drawings { get; set; } |
| | 21 | |
|
| 68 | 22 | | public IEnumerable<string> DrawingIds { get; set; } |
| | 23 | |
|
| 21 | 24 | | public CollectionModel() |
| | 25 | | { |
| 21 | 26 | | Drawings = new List<DrawingModel>(); |
| 21 | 27 | | DrawingIds = new List<string>(); |
| 21 | 28 | | } |
| | 29 | |
|
| | 30 | | public override string ToString() |
| | 31 | | { |
| 0 | 32 | | StringBuilder sb = new StringBuilder(); |
| | 33 | |
|
| 0 | 34 | | sb.Append(Id); |
| | 35 | |
|
| 0 | 36 | | if (!String.IsNullOrEmpty(Name)) |
| | 37 | | { |
| 0 | 38 | | sb.Append($" ({Name})"); |
| | 39 | | } |
| | 40 | |
|
| 0 | 41 | | return sb.ToString(); |
| | 42 | | } |
| | 43 | |
|
| 0 | 44 | | public string GetId() => Id; |
| | 45 | | } |