Inherit Umbraco propertiy values to a custom model
I am very new to Umbraco and I need help understanding how I can inherit umbraco modelproperties to my custom model loginViewModel.
My loginViewModel is used on a view called Mypages (MinaSidor). And i like to enable some part of the view to be modified by the umbraco backoffice users. They should be able to set new bodyText and etc.
I am trying to map my view to the umbracos PublishedModels.
My @Model has the context of LoginviewModel and the ContenModels has the context of MinaSidor, (Umbraco.Web.PublishedModels.MinaSidor;)
I have tried to implement IpublishedContent on my model but I keep generating NullreferenceException whenever i call any action from my controller.
public class LoginViewModel
{
private IPublishedContent _publishedContent;
public LoginViewModel() { }
[Required]
[DisplayName("Epost")]
[DataType(DataType.EmailAddress)]
public string Username { get; set; }
[Required]
[DisplayName("Lösenord")]
[DataType(DataType.Password)]
public string Password { get; set; }
public UserInformationModel UserInformationModel { get; set; }
If the solution is to inherit from Ipublishcontent in my loginViewModel Could anyone give an example to avoid the nullreference exception on the controller.
Controller:
[HttpPost]
[ValidateAntiForgeryToken]
public async Task
Inherit Umbraco propertiy values to a custom model
I am very new to Umbraco and I need help understanding how I can inherit umbraco modelproperties to my custom model loginViewModel.
My loginViewModel is used on a view called Mypages (MinaSidor). And i like to enable some part of the view to be modified by the umbraco backoffice users. They should be able to set new bodyText and etc.
I am trying to map my view to the umbracos PublishedModels.
My @Model has the context of LoginviewModel and the ContenModels has the context of MinaSidor, (Umbraco.Web.PublishedModels.MinaSidor;)
I have tried to implement IpublishedContent on my model but I keep generating NullreferenceException whenever i call any action from my controller.
View;
Model without IpublishContent
If the solution is to inherit from Ipublishcontent in my loginViewModel Could anyone give an example to avoid the nullreference exception on the controller.
Controller:
[HttpPost] [ValidateAntiForgeryToken] public async Task
is working on a reply...