Exemplo n.º 1
0
        private List<Media> PopulateMedia()
        {
            MediaType movies = new MediaType { Type = "Kvikmyndir" };
            MediaType tvShows = new MediaType { Type = "Þættir" };

            MediaGenre avisaga = new MediaGenre { Genre = "Ævisaga" };
            MediaGenre romantik = new MediaGenre { Genre = "Rómantík" };
            MediaGenre scifi = new MediaGenre { Genre = "Sci-Fi" };

            Media media1 = new Media { Name = "Catch me if you can", DateAired = new DateTime(2002, 12, 25), ImdbUrl = "http://www.imdb.com/title/tt0264464/?ref_=nv_sr_1", Type = movies, PosterUrl = "http://ia.media-imdb.com/images/M/MV5BMTY5MzYzNjc5NV5BMl5BanBnXkFtZTYwNTUyNTc2._V1_SX640_SY720_.jpg", Genre = avisaga, TypeId = 1, DownloadCount = 1 };
            Media media2 = new Media { Name = "The Notebook", DateAired = new DateTime(2003, 06, 25), ImdbUrl = "http://www.imdb.com/title/tt0332280/?ref_=nv_sr_1", Type = movies, PosterUrl = "http://ia.media-imdb.com/images/M/MV5BMTUwMDg3OTA2N15BMl5BanBnXkFtZTcwNzc5OTYwOQ@@._V1_SX640_SY720_.jpg", Genre = romantik, TypeId = 1, DownloadCount = 5 };
            Media media3 = new Media { Name = "The Matrix", DateAired = new DateTime(1999, 3, 21), ImdbUrl = "http://www.imdb.com/title/tt0133093/?ref_=nv_sr_1", Type = movies, PosterUrl = "http://ia.media-imdb.com/images/M/MV5BMTkxNDYxOTA4M15BMl5BanBnXkFtZTgwNTk0NzQxMTE@._V1_SX640_SY720_.jpg", Genre = scifi, TypeId = 1, DownloadCount = 7 };
            var medias = new List<Media>() { media1, media2, media3 };
            return medias;
        }
Exemplo n.º 2
0
 public void AddMedia(Media m)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 3
0
        public ActionResult NewMedia(MediaViewModel model)
        {
            if (ModelState.IsValid)
            {

                var newMedia = new Media()
                {
                    Name = model.Name,
                    DateAired = model.DateAired,
                    GenreId = model.GenreId,
                    ImdbUrl = model.ImdbUrl,
                    PosterUrl = model.PosterUrl,
                    TypeId = model.TypeId,
                    DownloadCount = 0
                };
                m_repo.AddMedia(newMedia);
                return RedirectToAction("Media", new { id = newMedia.Id });
            }
            return View(model);
        }
Exemplo n.º 4
0
 public void AddMedia(Media m)
 {
     m_db.Medias.Add(m);
     m_db.SaveChanges();
 }