Got models pulled apart and simplified, much less inheritance and easier to follow, start wiring up the model binding logic for content along with validation for each variant
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using AutoMapper;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for AutoMapper's <see cref="ResolutionContext"/>
|
||||
/// </summary>
|
||||
internal static class ResolutionContextExtensions
|
||||
{
|
||||
public const string CultureKey = "ContextMapper.Culture";
|
||||
|
||||
/// <summary>
|
||||
/// Returns the language Id in the mapping context if one is found
|
||||
/// </summary>
|
||||
/// <param name="resolutionContext"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCulture(this ResolutionContext resolutionContext)
|
||||
{
|
||||
if (!resolutionContext.Options.Items.TryGetValue(CultureKey, out var obj)) return null;
|
||||
|
||||
if (obj is string s)
|
||||
return s;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user