When I do change List of Groups in method EditSelectList, it also affect ViewBag.Groups. Why is it happening? I assigned ViewBag earlier. It should not affect ViewBag.Groups and var tournamentsGroups
I have this code in controller:
[AllowAnonymous]
public ActionResult Details2(int id)
{
    var tournamentsContext = new TournamentsContext();
    var tournament = tournamentsContext.Tournament.Single(t => t.Id == id);
    var groupsContext = new GroupsContext();
    var tournamentsGroups = groupsContext.Groups.Where(g => g.IdTournament == tournament.Id && g.SexMale == true).ToList();
    ViewBag.Groups = tournamentsGroups;
    ViewBag.groupId = new SelectList(EditSelectList(tournamentsGroups), "Id", "Belt");
    ViewBag.tournamentId = id;
    ViewBag.InTournament = CurrentUserInTournament(tournament.Id, currentUser);
    return View(tournament);
}
private List<Groups> EditSelectList(List<Groups> groups)
{
    foreach (var item in groups)
    {
        item.Belt = item.Belt + " - " + item.WeightKg; // for dropdownlist
    }
    return groups;
}
and View
@model TournamentApp.Models.Tournament
@foreach (var item in ViewBag.Groups)
{
    if ("white".Equals(@item.Belt) || true)
    {
        <h4>@item.Belt</h4>
    }
}
// ... some another code for dropdownlist
so result is:
white - 65
white - 75
white - 85
blue - 75
but it should be just:
white
white
white
blue
 
     
    