I need to pass list of records to class variable (Users and Groups) in view model but I cannot seeing view model object (_UserAndGroupModel) recognizing its class object, I am not sure exactly what I am missing here.
ViewModel
public class UserGroup_ViewModel
{
public User Users { get; set; }
public Group Groups { get; set; }
}
each class user and group have their variables and collection Items
In following lines of code I need to pass list and and assign to user object and groups object within the view model
public partial class UserManagement_Services
{
List<UserGroup_ViewModel> _UserAndGroupModel = new List<UserGroup_ViewModel>();
public void GetUserAndGroups()
{
using(var _uow = new UserManagement_UnitOfWork())
{
_UserAndGroupModel.Users= _uow.User_Repository.GetAll();
_UserAndGroupModel.Groups = _uow.Group_Repository.GetAll();
//error here ??????????????
}
}
}

Controller Method
public ActionResult AddUserInGroup()
{
var _UserAndGroupList = _userServices.GetUserAndGroups();
return PartialView("AddUserInGroup_Partial", _UserAndGroupList);
}
View
@model IEnumerable<App.DAL.Model.UserGroup_ViewModel>
@Html.DisplayNameFor(model => model) @Html.DisplayNameFor(model => model.LastName) @Html.DisplayNameFor(model => model.Age) @Html.DisplayNameFor(model => model.EmailAddress)
@foreach (var item in Model)
{....
In view I cannot see ViewModel class variable when I do model => model.????
var, if you know that_userServices.GetUserAndGroups()returns aUserGroup_ViewModelthen use it.