Ejemplo n.º 1
0
 public ActionResult Details(int id)
 {
     var downloads = new DownloadCollection();
     using (var database = new DatabaseEntities())
     {
         var item = database.ItemById(id);
         if (item == null)
             return HttpNotFound();
         downloads.PrimaryItem = new ItemViewModel(item);
         AddDependencies(downloads, item);
     }
     return Json(downloads, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 2
0
 private void AddDependencies(DownloadCollection collection, Item item)
 {
     collection.Items.Add(new ItemViewModel(item));
     foreach (var blob in item.Blobs)
     {
         collection.Downloads.Add(new Download
         {
             DestinationPath = blob.DestinationPath,
             DownloadUrl = blob.DownloadUrl
         });
     }
     foreach (var dependency in item.Dependencies)
         AddDependencies(collection, dependency.Item);
 }