Reputation: 333
I was given some help on here recently and set up a view model called RegisterViewModel containing fields from (currently) two different models. This worked and I can use it to register a new user along with related user info. My problem is viewing the details from this same view model. In the Usee controller in my 'Details' method I have the same code -
public ViewResult Details(RegisterViewModel viewModel)
{
TRSContext context = new TRSContext();
User currentuser = context.Users
.Include(i => i.UserDetails)
.Where(i => i.UserName == viewModel.UserName)
.Single();
currentuser.UserDetails = new UserDetails();
return View(userRepository.Find(viewModel.UserName));
}
But I am getting the error -
Cannot convert lambda expression to type 'string' because it is not a delegate type
for the line -
(i => i.UserDetails)
Any ideas what's wrong with this?
Upvotes: 0
Views: 71