This is my simple class:
public class Friends
{
public Friends()
{
Myfriend = new List<string>();
Share = new List<bool>();
}
public List<string> Myfriend { get; set; }
public List<bool> Share { get; set; }
}
This is the class i want to pass into my view. Before I do that I would like to "fill" up
public List<string> Myfriend { get; set; }
With the values i have in another list of strings.
var listofUsersFriends <--- This list contains a bunch of names(strings).
Can I assign the values i a way similar to this:
var model = new Friends();
foreach (var item in listofUsersFriends)
{
//Add list items
}
I'm totally stuck, feel free to give advice on other ways of solving this =) Thanks!
EDIT: The end goal is to pass a model to my view containing a list friend-objects. Like this: Bob CheckboxShare Wouter CheckboxShare ETC..
This seems to send a model with two separate strings, i.e the checkbox is not related to the friend. I know I have messed up somewhere but i do not understand how to solve it.