/// <summary> /// Saves the pod cast. /// </summary> /// <param name="podCast">The pod cast.</param> /// <exception cref="Uncas.PodCastPlayer.Repository.RepositoryException"></exception> public void SavePodCast( PodCastDetailsViewModel podCast) { if (podCast == null || podCast.Url == null) { return; } var pc = this.GetDBPodCast(podCast.Id); if (pc == null) { return; } pc.Author = podCast.Author; pc.Description = podCast.Description; pc.PodCastId = (long)podCast.Id; pc.Name = podCast.Name; pc.Url = podCast.Url.ToString(); try { this.DB.Update <DBPodCast>(pc); } catch (Exception ex) { // TODO: EXCEPTION: Unknown SubSonic exceptions throw new RepositoryException( "Error trying to update pod cast in database", ex); } }
/// <summary> /// Saves the pod cast. /// </summary> /// <param name="podCast">The pod cast.</param> public void SavePodCast(PodCastDetailsViewModel podCast) { if (podCast.Id.HasValue) { var existingPodCast = PodCasts.Where(pc => pc.Id.Value == podCast.Id.Value) .SingleOrDefault(); if (existingPodCast != null) { existingPodCast.Name = podCast.Name; existingPodCast.Url = podCast.Url; return; } } int newId = (PodCasts.Max(pc => pc.Id) ?? 0) + 1; var newPodCast = new PodCast( newId, podCast.Name, podCast.Url); PodCasts.Add(newPodCast); }
public void SavePodCast_Existing_OK() { // Arrange: var podCast = new PodCastDetailsViewModel( 1, "X", new Uri("http://test.asdweqwe"), "x", "x"); // Act: this.PodCastRepository.SavePodCast(podCast); // Assert: }
public void SavePodCast_Existing_OK() { // Arrange: var podCast = new PodCastDetailsViewModel( 1, "x", new Uri("http://xxx.dddd.wwww"), "x", "x"); // Act: this.service.SavePodCast(podCast); // Assert: }
public void SavePodCast_New_OK() { // Arrange: Uri url = new Uri("http://xxx.ddd.wweerr"); var podCast = new PodCastDetailsViewModel( null, "x", url, "x", "x"); // Act: this.service.SavePodCast(podCast); // Assert: }
/// <summary> /// Saves the pod cast. /// </summary> /// <param name="podCast">The pod cast.</param> /// <exception cref="Uncas.PodCastPlayer.Repository.RepositoryException"></exception> public void SavePodCast( PodCastDetailsViewModel podCast) { this.PodCastRepository.SavePodCast(podCast); }