Updating List<T> in DbContext

I have a Model like this\[code\]public class Challenge{ public int ID { get; set; } public string Name { get; set; } public string Blurb { get; set; } public int Points { get; set; } public string Category { get; set; } public string Flag { get; set; } public List<string> SolvedBy { get; set; }}public class ChallengeDBContext : DbContext{ public DbSet<Challenge> Challenges { get; set; }}\[/code\]and then Controller like this. But I cannot update the List "SolvedBy", the next time I step through with the debugger, the list is still empty.\[code\] [HttpPost] public string Index(string flag = "", int id=0) { Challenge challenge = db.Challenges.Find(id); if (flag == challenge.Flag) { var chall = db.Challenges.Find(id); if (chall.SolvedBy == null) { chall.SolvedBy = new List<string>(); } chall.SolvedBy.Add(User.Identity.Name); db.Entry(chall).State = EntityState.Modified; db.SaveChanges(); //congrats, you solved the puzzle return "got it"; } else { return "fail"; } }\[/code\]is there any way around it to make a list of strings kept in the database?
 
Back
Top