コード例 #1
0
 private TrackDetail TrackDetailBuilder(Track track)
 {
     TrackDetail result = new TrackDetail();
     result.Id = track.TrackId;
     result.AlbumId = track.AlbumId;
     result.TrackName = track.Name;
     result.Rate = track.Rate;
     Album album = db.Albums.Find(track.AlbumId);
     result.AlbumName = album.Name;
     result.AutorId = album.AutorId;
     Autor autor = db.Autors.Find(album.AutorId);
     result.AutorName = autor.Name;
     return result;
 }
コード例 #2
0
 private void EditItem(TrackViewModel model)
 {
     Track track = new Track
     {
         AlbumId = GetAlbumId(model.AlbumName),
         Name = model.Name,
         Rate = model.Rate,
         TrackId = model.Id
     };
     db.Entry(track).State=EntityState.Modified;
     db.SaveChanges();
 }
コード例 #3
0
 private TrackViewModel EditViewModelInitializer(Track track)
 {
     TrackViewModel result = new TrackViewModel
     {
         AlbumName = db.Albums.Find(track.AlbumId).Name,
         Id = track.TrackId,
         list = GetItemList(),
         Name = track.Name,
         Rate = track.Rate
     };
     return result;
 }
コード例 #4
0
 private void AddItemToRepository(TrackViewModel model)
 {
     Track track = new Track
     {
         AlbumId = GetAlbumId(model.AlbumName),
         Name = model.Name,
         Rate = model.Rate
     };
     db.Tracks.Add(track);
     db.SaveChanges();
 }
コード例 #5
0
 private TrackDetail TrackDetailsViewModelConfig(Track track)
 {
     TrackDetail result = new TrackDetail
     {
         AlbumId = track.AlbumId,
         AutorName = db.Autors.Find(db.Albums.Find(track.AlbumId).AutorId).Name,
         AlbumName = db.Albums.Find(track.AlbumId).Name,
         AutorId = db.Albums.Find(track.AlbumId).AutorId,
         Id = track.TrackId,
         Rate = track.Rate,
         TrackName = track.Name
     };
     return result;
 }