// // GET: / public ActionResult Index() { CloudTableClient cloudTableClient = this.StorageAccount.CreateCloudTableClient(); var photoContext = new PhotoDataServiceContext(cloudTableClient); return this.View(photoContext.GetPhotos().Select(x => this.ToViewModel(x)).ToList()); }
// // GET: / public ActionResult Index() { CloudTableClient cloudTableClient = new CloudTableClient(this.UriTable, new StorageCredentials(this.PublicTableSas)); var photoContext = new PhotoDataServiceContext(cloudTableClient); var photoList = new List<PhotoViewModel>(); var photos = photoContext.GetPhotos(); if (photos.Count() > 0) { photoList = photos.Select(x => this.ToViewModel(x)).ToList(); } var privatePhotos = new List<PhotoViewModel>(); if (this.User.Identity.IsAuthenticated) { cloudTableClient = new CloudTableClient(this.UriTable, new StorageCredentials(this.AuthenticatedTableSas)); photoContext = new PhotoDataServiceContext(cloudTableClient); photos = photoContext.GetPhotos(); if (photos.Count() > 0) { photoList.AddRange(photos.Select(x => this.ToViewModel(x)).ToList()); } } return this.View(photoList); }
// // GET: / public ActionResult Index() { this.RefreshAccessCredentials(); CloudTableClient cloudTableClient = new CloudTableClient(this.Uri, new StorageCredentials(Session["Sas"].ToString())); var photoContext = new PhotoDataServiceContext(cloudTableClient); var publicPhotos = photoContext.GetPhotos("Public").Select(x => this.ToViewModel(x)).ToList(); var privatePhotos = new List<PhotoViewModel>(); if (this.User != null) { privatePhotos = photoContext.GetPhotos(this.User.Identity.Name).Select(x => this.ToViewModel(x)).ToList(); } return this.View(); }