public List <ViewInterestedClass> GetClassId(int UserId) { List <InterestedClass> list = _repository.GetClassId(UserId); List <ViewInterestedClass> model = new List <ViewInterestedClass>(); foreach (var item in list) { model.Add(ViewInterestedClass.ToViewModel(item)); } return(model); }