예제 #1
0
 public bool Delete(Survey survey)
 {
     using (IDbConnection db = _factory.OpenDbConnection())
     {
         db.Delete<Survey>(survey);
         return true;
     }
 }
예제 #2
0
        public Survey Add(Survey survey)
        {
            using (IDbConnection db = _factory.OpenDbConnection())
            {
                db.Insert<Survey>(survey);

                survey.Id = db.GetLastInsertId();

                return survey;
            }
        }
예제 #3
0
 private long FirstSegmentId(Survey survey, IDbConnection db)
 {
     return db.QueryScalar<long>(@"SELECT TOP 1 Id FROM Segment WHERE SurveyId = @surveyId ORDER BY [Order],Id", new { surveyId = survey.Id });
 }
예제 #4
0
 public Survey Update(Survey survey)
 {
     using (IDbConnection db = _factory.OpenDbConnection())
     {
         db.Update<Survey>(survey);
         return survey;
     }
 }
예제 #5
0
 private Survey PopulateDerived(Survey survey, IDbConnection db)
 {
     survey.FirstSegmentId = FirstSegmentId(survey, db);
     return survey;
 }