示例#1
0
 public void CreateAlbum(AlbumDTO album)
 {
     Album newAlbum = new Album {
         Name = album.Name,
         Photos = new List<Photo>()
     };
     _repo.Add<Album>(newAlbum);
     _repo.SaveChanges();
 }
示例#2
0
 public ActionResult Create(AlbumDTO album)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid) {
             //Album newAlbum = new Album {
             //    Name = album.Name
             //};
             _service.CreateAlbum(album);
             return RedirectToAction("Index");
         }
         return View();
     }
     catch
     {
         return View();
     }
 }
示例#3
0
 public List<Photo> GetPhotosByAlbum(AlbumDTO album)
 {
     return _repo.Find<Album>(album).Photos;
 }