reactredux/webapi/WeatherForecast/Models/L10n/ImageL10nModel.cs

24 lines
578 B
C#

using Core.Abstractions;
using Core.Abstractions.Models;
using Core.DomainObjects.L10n;
using Core.Enumerations;
namespace WeatherForecast.Models.L10n {
public class ImageL10nModel : ModelBase {
public string Locale { get; set; }
public string Alt { get; set; }
public ImageL10nModel() { }
public ImageL10nModel(ImageL10n imageL10n) {
Locale = imageL10n.Locale.Name;
Alt = imageL10n.Alt;
}
public ImageL10n ToDomainObject() => new ImageL10n {
Locale = Enumeration.FromDisplayName<Locales>(Locale),
Alt = Alt
};
}
}