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>()); } }
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); }
public List <QuizCategories> SaveQuizCategory(QuizCategories Obj) { BlQuiz Quiz = new BlQuiz(); return(Quiz.SaveQuizCategory(Obj)); }