|
4 | 4 | namespace Umbraco.Core.Models |
5 | 5 | { |
6 | 6 | /// <summary> |
7 | | - /// Model used in Razor Views for rendering |
| 7 | + /// Represents a media item with local crops. |
8 | 8 | /// </summary> |
| 9 | + /// <seealso cref="Umbraco.Core.Models.PublishedContent.PublishedContentWrapped" /> |
9 | 10 | public class MediaWithCrops : PublishedContentWrapped |
10 | 11 | { |
| 12 | + /// <summary> |
| 13 | + /// Gets the media item. |
| 14 | + /// </summary> |
| 15 | + /// <value> |
| 16 | + /// The media item. |
| 17 | + /// </value> |
11 | 18 | public IPublishedContent MediaItem => Unwrap(); |
12 | 19 |
|
| 20 | + /// <summary> |
| 21 | + /// Gets the local crops. |
| 22 | + /// </summary> |
| 23 | + /// <value> |
| 24 | + /// The local crops. |
| 25 | + /// </value> |
13 | 26 | public ImageCropperValue LocalCrops { get; } |
14 | 27 |
|
| 28 | + /// <summary> |
| 29 | + /// Initializes a new instance of the <see cref="MediaWithCrops" /> class. |
| 30 | + /// </summary> |
| 31 | + /// <param name="content">The content.</param> |
| 32 | + /// <param name="localCrops">The local crops.</param> |
15 | 33 | public MediaWithCrops(IPublishedContent content, ImageCropperValue localCrops) |
16 | 34 | : base(content) |
17 | 35 | { |
18 | 36 | LocalCrops = localCrops; |
19 | 37 | } |
20 | 38 | } |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// Represents a media item with local crops. |
| 42 | + /// </summary> |
| 43 | + /// <typeparam name="T">The type of the media item.</typeparam> |
| 44 | + /// <seealso cref="Umbraco.Core.Models.PublishedContent.PublishedContentWrapped" /> |
| 45 | + public class MediaWithCrops<T> : MediaWithCrops |
| 46 | + where T : IPublishedContent |
| 47 | + { |
| 48 | + /// <summary> |
| 49 | + /// Gets the media item. |
| 50 | + /// </summary> |
| 51 | + /// <value> |
| 52 | + /// The media item. |
| 53 | + /// </value> |
| 54 | + public new T MediaItem { get; } |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Initializes a new instance of the <see cref="MediaWithCrops{T}" /> class. |
| 58 | + /// </summary> |
| 59 | + /// <param name="content">The content.</param> |
| 60 | + /// <param name="localCrops">The local crops.</param> |
| 61 | + public MediaWithCrops(T content, ImageCropperValue localCrops) |
| 62 | + : base(content, localCrops) |
| 63 | + { |
| 64 | + MediaItem = content; |
| 65 | + } |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Performs an implicit conversion from <see cref="MediaWithCrops{T}" /> to <see cref="T" />. |
| 69 | + /// </summary> |
| 70 | + /// <param name="mediaWithCrops">The media with crops.</param> |
| 71 | + /// <returns> |
| 72 | + /// The result of the conversion. |
| 73 | + /// </returns> |
| 74 | + public static implicit operator T(MediaWithCrops<T> mediaWithCrops) => mediaWithCrops.MediaItem; |
| 75 | + } |
21 | 76 | } |
0 commit comments