public static Course GetUsersCourses(string email) { try { IDataProvider data = new MongoDataProvider(); var course = new Course(); var enumerableCourses = data.GetMultiple <DAL.Course>("Author", email); course.ModelCourses = new List <Model.Course>(); foreach (var enumerableCourse in enumerableCourses) { enumerableCourse.Identification = enumerableCourse._id.ToString(); course.ModelCourses.Add(enumerableCourse); } return(course); } catch (Exception) { return(null); } }
public static List <Quiz> GetAllGenericQuizzes() { try { var result = new List <Quiz>(); IDataProvider data = new MongoDataProvider(); var quizzes = data.GetMultiple <DAL.Quiz>("", ""); foreach (var quiz in quizzes) { var bllQuiz = new Quiz(); bllQuiz.Identification = quiz._id.ToString(); bllQuiz.ModelQuiz = quiz; result.Add(bllQuiz); } return(result); } catch (Exception) { return(null); } }
public static List <Word> GetAllWords() { try { IDataProvider data = new MongoDataProvider(); var enumerableWords = data.GetMultiple <DAL.Word>("", ""); var words = new List <Word>(); foreach (var enumerableWord in enumerableWords) { var word = new Word(); word.Identification = enumerableWord._id.ToString(); word.ModelWord = enumerableWord; words.Add(word); } return(words); } catch (Exception) { return(null); } }