public SharedFollow GetFollowById(int FollowId) { SharedFollow follow = null; lock (m_followLock) { string sql = "SELECT " + SelectFollowSQLFields + " FROM TwitchFollow WHERE Id=:followid;"; follow = m_context.Database.SqlQuery <SharedFollow>(sql, new SQLiteParameter[] { new SQLiteParameter(":followid", FollowId) }).FirstOrDefault(); } return(follow); }
public SharedFollow SaveFollow(SharedFollow follow) { SQLiteParameter[] parms = new SQLiteParameter[] { new SQLiteParameter(":id", follow.Id), new SQLiteParameter(":fromuserid", follow.FromUserId), new SQLiteParameter(":touserid", follow.ToUserId), new SQLiteParameter(":followdate", follow.FollowDate) }; SharedFollow Result = follow; lock (m_followLock) { m_context.Database.ExecuteSqlCommand(InsertFollowSQL, parms); int lastid = m_context.Database.SqlQuery <int>(GetLastInsertedFollowSQL, new SQLiteParameter[] { }).FirstOrDefault(); Result.Id = lastid; } return(Result); }