I'm having trouble updating an IList within an IList with a new row of data. Both Add() and AddRange() are not working out.
Please excuse my clumsy attempt to describe the landscape I'm working with.
public class DetailViewModel
{
public int id { get; set; }
public decimal qualScore { get; set; }
public int testCount { get; set; }
public string qualRating { get; set; }
public IList<QCheckList> qualCheck { get; set; }
}
public class QCheckList
{
public int printOrder { get; set; }
public string description{ get; set; }
public int? value { get; set; }
public string grade { get; set; }
}
In the controller I have
vm = new DetailViewModel();
// other code here to read data from the DB into vm, then later...
List<QCheckList> Qual1 = calc.qualifyMark(score, subject);
The method qualityMark() returns a List of type QCheckList.
I then want to write Qual1 to the qualCheck IList in the vm IList and have tried (unsuccessfully) both:
vm.qualCheck.AddRange(Qual1);
error says IList<QCheckList> does not contain a definition for AddRangevm.qualCheck.Add(Qual1);
error says System.Collections.Generic.List<Objects.ViewModels.QCheckList> to Objects.ViewModels.QCheckList
Neither of those errors make sense to me but they probably do to one of you. Can you please explain (for a dummy like me) how to fix this so the results of the method are added to the qualCheck IList in vm. Thanks