using System;
using System.Collections.Generic;
using System.Linq;
using Telerik.ILS.Data.Common.Repositories;
using Telerik.ILS.Data.Models;
using Telerik.ILS.Services.Common.CodeExecutor;
public class RunThisCode
{
public void Execute(IRepository<Survey> surveys, IRepository<User> users, IWriter writer)
{
var surveyId = 33;
var usernames = new List<string>()
{
"users"
};
var survey = surveys.GetById(surveyId);
foreach (var username in usernames)
{
var user = users.All().FirstOrDefault(x => x.Username == username);
survey.UsersInSurveys.Add(new UsersInSurvey() { User = user });
}
//surveys.SaveChanges();
}
}