/// <summary> /// Create a new quiz object. /// </summary> /// <param name="quizID">Initial value of the quizID property.</param> /// <param name="quizName">Initial value of the quizName property.</param> public static quiz Createquiz(global::System.Int32 quizID, global::System.String quizName) { quiz quiz = new quiz(); quiz.quizID = quizID; quiz.quizName = quizName; return(quiz); }
public void GetQuiz(string id) { JavaScriptSerializer js = new JavaScriptSerializer(); CommonLayer.quiz data = new CommonLayer.quiz(); var getQuiz = DataLayer.LecturerRepository.Instance.getQuizById(int.Parse(id)); data.quizName = getQuiz.quizName; data.quizID = getQuiz.quizID; Context.Response.Write(js.Serialize(data)); }
//Delete quiz by id public string deleteQuiz(int id) { try { CommonLayer.quiz quiz = getQuizById(id); this.Entity.quizs.DeleteObject(quiz); this.Entity.SaveChanges(); return("Quiz Deleted :)"); } catch (Exception ex) { return(ex.Message); } }
//Edit quiz name by id public bool updateQuizName(int id, string name) { try { CommonLayer.quiz quiz = getQuizById(id); quiz.quizName = name; this.Entity.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
//Add Quiz public string AddQuiz(string quizName) { try { CommonLayer.quiz quz = new CommonLayer.quiz(); quz.quizName = quizName; this.Entity.quizs.AddObject(quz); this.Entity.SaveChanges(); return("Added sucessfully :)"); } catch (Exception ex) { return(ex.Message); } }
/// <summary> /// Create a new quiz object. /// </summary> /// <param name="quizID">Initial value of the quizID property.</param> /// <param name="quizName">Initial value of the quizName property.</param> public static quiz Createquiz(global::System.Int32 quizID, global::System.String quizName) { quiz quiz = new quiz(); quiz.quizID = quizID; quiz.quizName = quizName; return quiz; }
/// <summary> /// Deprecated Method for adding a new object to the quizs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToquizs(quiz quiz) { base.AddObject("quizs", quiz); }
//Add Quiz public string AddQuiz(string quizName) { try { CommonLayer.quiz quz = new CommonLayer.quiz(); quz.quizName = quizName; this.Entity.quizs.AddObject(quz); this.Entity.SaveChanges(); return "Added sucessfully :)"; } catch (Exception ex) { return ex.Message; } }
public void GetQuizsDropDown() { JavaScriptSerializer js = new JavaScriptSerializer(); var getList = DataLayer.LecturerRepository.Instance.GetAllQuiz(); var data = new List<quiz>(); foreach (quiz q in getList) { var tq = new quiz(); tq.quizName = q.quizName; tq.quizID = q.quizID; data.Add(tq); } Context.Response.Write(js.Serialize(data)); }