Ejemplo n.º 1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Songs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSongs(Song song)
 {
     base.AddObject("Songs", song);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Song object.
 /// </summary>
 /// <param name="songID">Initial value of the SongID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="artist">Initial value of the Artist property.</param>
 public static Song CreateSong(global::System.Guid songID, global::System.String name, global::System.String artist)
 {
     Song song = new Song();
     song.SongID = songID;
     song.Name = name;
     song.Artist = artist;
     return song;
 }
Ejemplo n.º 3
0
 public CreateSongVM(Song song)
 {
     Song = song;
     Reports = new ChwinockEntities().Reports;
 }
Ejemplo n.º 4
0
        public ActionResult CreateSong(CreateSongVM model, List<String> AssociatedReports)
        {
            var db = new ChwinockEntities();

            var newSong = new Song();
            newSong.SongID = Guid.NewGuid();
            newSong.Artist = model.Song.Artist;
            newSong.Name = model.Song.Name;
            newSong.Url = model.Song.Url;

            if (AssociatedReports != null)
            {
                foreach (var r in AssociatedReports)
                {
                    var id = Guid.Parse(r);
                    newSong.Reports.Add(db.Reports.Single(x => x.ReportID == id));
                }
            }

            db.Songs.AddObject(newSong);

            db.SaveChanges();

            return RedirectToAction("Manage");
        }
Ejemplo n.º 5
0
 //Constructors
 public CreateSongVM()
 {
     Song = new Song();
     Reports = new ChwinockEntities().Reports;
 }