RadioDld.Model.Favourite.AddAsync C# (CSharp) Method

AddAsync() private static method

private static AddAsync ( int progid ) : void
progid int
return void
        private static void AddAsync(int progid)
        {
            lock (DbUpdateLock)
            {
                using (SQLiteCommand command = new SQLiteCommand("insert into favourites (progid) values (@progid)", FetchDbConn()))
                {
                    command.Parameters.Add(new SQLiteParameter("@progid", progid));

                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    catch (SQLiteException sqliteExp)
                    {
                        if (sqliteExp.ErrorCode == SQLiteErrorCode.Constraint)
                        {
                            // Already added while this was waiting in the threadpool
                            return;
                        }

                        throw;
                    }
                }
            }

            if (Added != null)
            {
                Added(progid);
            }

            RaiseUpdated(progid);
        }