Beispiel #1
0
        public ActionResult Detail(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            var artWork = _artWorkRepository.GetArtwork(id.Value);

            return(View(artWork));
        }
        private async void showArtwork(int?TypeID)
        {
            //Show Progress
            progRing.IsActive   = true;
            progRing.Visibility = Visibility.Visible;

            ArtworkRepository r = new ArtworkRepository();

            try
            {
                List <Artwork> artworks;
                if (TypeID.GetValueOrDefault() > 0)
                {
                    artworks = await r.GetArtworkByType(TypeID.GetValueOrDefault());
                }
                else
                {
                    artworks = await r.GetArtwork();
                }
                artworkList.ItemsSource = artworks.OrderByDescending(e => e.ID);
            }
            catch (ApiException apiEx)
            {
                var sb = new StringBuilder();
                sb.AppendLine("Errors:");
                foreach (var error in apiEx.Errors)
                {
                    sb.AppendLine("-" + error);
                }
                Common.ShowMessage("Could not complete operation:", sb.ToString());
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                if (ex.InnerException.Message.Contains("server"))
                {
                    Common.ShowMessage("Error", "No connection with the server.");
                }
                else
                {
                    Common.ShowMessage("Error", "Could not complete operation.");
                }
            }
            finally
            {
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
        }