Esempio n. 1
0
 public void UpdatePhoto(string pathName)
 {
     var photo = GetPhotoByPath(pathName);
     Photo newPhoto = new Photo {
         Description = photo.Description,
         Rating = photo.Rating,
         Title = photo.Title
     };
     _repo.SaveChanges();
 }
Esempio n. 2
0
 public void AddPhoto(string albumName, PhotoDTO photo, string fileName)
 {
     Photo newPhoto = new Photo {
         Description = photo.Description,
         Path = fileName,
         Rating = photo.Rating,
         Title = photo.Title,
         //InAlbum = _service.GetAlbumByName(albumName)
     };
     Album album = GetAlbumByName(albumName);
     List<Photo> photoList = album.Photos;
     if(photoList != null) {
         photoList.Add(newPhoto);
     } else {
         photoList = new List<Photo> {
             newPhoto
         };
     }
     album.Photos = photoList;
     _repo.Add<Photo>(newPhoto);
     _repo.SaveChanges();
 }