public bool Delete(Survey survey) { using (IDbConnection db = _factory.OpenDbConnection()) { db.Delete<Survey>(survey); return true; } }
public Survey Add(Survey survey) { using (IDbConnection db = _factory.OpenDbConnection()) { db.Insert<Survey>(survey); survey.Id = db.GetLastInsertId(); return survey; } }
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 }); }
public Survey Update(Survey survey) { using (IDbConnection db = _factory.OpenDbConnection()) { db.Update<Survey>(survey); return survey; } }
private Survey PopulateDerived(Survey survey, IDbConnection db) { survey.FirstSegmentId = FirstSegmentId(survey, db); return survey; }