public void Save(ShapesOverImage question) { if (question.Id == 0) { ShapesOverImageRepository.Create(question); } else { ShapesOverImageRepository.Update(question); } }
public void Update(ShapesOverImage question) { if (this.connection == null) { this.connection = new ConnectionProvider(); } var settings = Serializer.Serialize(question.GetSettings()); this.connection.Db.Items_Update(question.Id, question.QuestionText, question.Notes, settings); this.connection.Db.SaveChanges(); }
//private static byte _questionTypeId = 220; public void Create(ShapesOverImage question) { if (this.connection == null) { this.connection = new ConnectionProvider(); } var questionId = new ObjectParameter("Questionid", typeof(int)); var settings = Serializer.Serialize(question.GetSettings()); this.connection.Db.Items_Insert(question.QuestionTypeId, question.QuestionText, question.Notes, settings, questionId); question.Id = (int)questionId.Value; this.connection.Db.SaveChanges(); }