public List <DataModel.Quiz> LoadAllQuizByCategory(QuizSearch Obj) { List <SqlParameter> Params = new List <SqlParameter>(); if (Obj != null) { Params.Add(new SqlParameter("CategoryName", Obj.CategoryName)); Params.Add(new SqlParameter("QuizName", Obj.QuizName)); Params.Add(new SqlParameter("CategoryId", Obj.CategoryId == 0 ? 0 : Obj.CategoryId)); Params.Add(new SqlParameter("PageNo", Obj.PageNo == 0 ? 1 : Obj.PageNo)); Params.Add(new SqlParameter("PageSize", Obj.PageSize == 0 ? 20 : Obj.PageSize)); } return(context.Database.SqlQuery <tblQuiz>("uspLoadQuizByCategory", Params.ToArray()).Select(x => new DataModel.Quiz() { ID = x.ID, Name = x.Name, Description = x.Description, Time = x.Timer == true ? true : false, Hours = x.Hours.Value, Minutes = x.Minutes.Value, AllowReAttempt = x.AllowReAttempt == true ? true : false, ReAttemptDuration = x.ReAttemptDuration.Value, PassMarks = x.PassMarks.Value, QuizUrl = x.QuizUrl, Category = (context.tblQuizCategories.Where(Q => Q.Id == x.Type).FirstOrDefault().Category), CreatedAt = x.CreatedAt.Value, UpdatedAt = x.UpdatedAt.Value }).OrderBy(x => x.Category).ToList()); }
public List <Quiz> LoadAllQuizByCategory(QuizSearch Obj) { QuizRepo repo = new QuizRepo(); return(repo.LoadAllQuizByCategory(Obj)); }
public List <Quiz> LoadAllQuizByCategory(QuizSearch Obj) { BlQuiz obj = new BlQuiz(); return(obj.LoadAllQuizByCategory(Obj)); }