public void RemoveVideo()
        {
            try
            {
                var options = CreateNewContextOptions();
                using (var db = new AuctionContext(options))
                {
                    AuctionTestHelper.PopulateDefaultData(db);
                }

                using (var db = new AuctionContext(options))
                {
                    var repository =
                        new AuctionRepository(db);

                    var item = GenerateModel();
                    Assert.DoesNotThrow(() => repository.Save(item));
                    var video = new AuctionVideo
                    {
                        Title       = "title",
                        Description = "description",
                        Video       = GenerateAttachment(),
                        AuctionId   = item.Id
                    };
                    Assert.DoesNotThrow(() => repository.AddVideo(item, video));
                    Assert.DoesNotThrow(() => repository.RemoveVideo(item, video));
                }
            }
            catch (Exception ex)
            {
                LogEventManager.Logger.Error(ex);
                throw;
            }
        }
Beispiel #2
0
 public void RemoveVideo(Server.Model.Auction.Auction auction, AuctionVideo video)
 {
     try
     {
         var auctionVideo = Db.Set <AuctionVideo>().Single(it => it.VideoId == video.VideoId && it.AuctionId == auction.Id);
         Db.Set <AuctionVideo>().Remove(auctionVideo);
         Db.SaveChanges();
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex.Message, ex);
         throw;
     }
 }
Beispiel #3
0
 public void AddVideo(Server.Model.Auction.Auction auction, AuctionVideo video)
 {
     try
     {
         video.AuctionId = auction.Id;
         Db.Set <AuctionVideo>().Add(video);
         Db.SaveChanges();
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex.Message, ex);
         throw;
     }
 }