示例#1
0
        public List <QuizCategories> SaveQuizCategory(QuizCategories Obj)
        {
            QuizRepo repo   = new QuizRepo();
            bool     result = repo.SaveQuizCategory(Obj);

            if (result)
            {
                return(repo.LoadAllCategories());
            }
            else
            {
                return(new List <QuizCategories>());
            }
        }
示例#2
0
        public bool SaveQuizCategory(QuizCategories Obj)
        {
            tblQuizCategory Category;

            if (Obj.Id == 0)
            {
                Category           = new tblQuizCategory();
                Category.Category  = Obj.Category;
                Category.IsDeleted = false;
                context.tblQuizCategories.Add(Category);
            }
            else
            {
                Category                      = context.tblQuizCategories.Where(x => x.Id == Obj.Id).FirstOrDefault();
                Category.Category             = Obj.Category;
                Category.IsDeleted            = Obj.IsDeleted;
                context.Entry(Category).State = EntityState.Modified;
            }
            int result = context.SaveChanges();

            return(result > 0 ? true : false);
        }
示例#3
0
        public List <QuizCategories> SaveQuizCategory(QuizCategories Obj)
        {
            BlQuiz Quiz = new BlQuiz();

            return(Quiz.SaveQuizCategory(Obj));
        }