Exemple #1
0
        /// <summary>
        /// Gets the DB pod cast.
        /// </summary>
        /// <param name="podCastId">The pod cast id.</param>
        /// <returns>The DB pod cast.</returns>
        /// <exception cref="Uncas.PodCastPlayer.Repository.RepositoryException"></exception>
        private DBPodCast GetDBPodCast(int?podCastId)
        {
            if (!podCastId.HasValue)
            {
                return(null);
            }

            DBPodCast podCast = null;

            try
            {
                podCast =
                    this.DB.Single <DBPodCast>(
                        podCastId);
            }
            catch (Exception ex)
            {
                // TODO: EXCEPTION: Unknown SubSonic exceptions
                throw new RepositoryException(
                          "Error trying to get pod cast",
                          ex);
            }

            return(podCast);
        }
Exemple #2
0
        /// <summary>
        /// Saves the pod cast.
        /// </summary>
        /// <param name="podCast">The pod cast.</param>
        /// <exception cref="Uncas.PodCastPlayer.Repository.RepositoryException"></exception>
        public void SavePodCast(
            PodCast podCast)
        {
            if (podCast == null ||
                podCast.Url == null)
            {
                return;
            }

            DBPodCast pc = new DBPodCast
            {
                Author      = podCast.Author,
                Description = podCast.Description,
                Name        = podCast.Name,
                Url         = podCast.Url.ToString()
            };

            try
            {
                this.DB.Add <DBPodCast>(pc);
            }
            catch (Exception ex)
            {
                // TODO: EXCEPTION: Unknown SubSonic exceptions
                throw new RepositoryException(
                          "Error trying to add pod cast to database",
                          ex);
            }

            podCast.Id = (int)pc.PodCastId;
        }