private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            ArtworkDTO artworkDTO = ((FrameworkElement)sender).DataContext as ArtworkDTO;
            Artwork    artwork    = new Artwork();

            //Userbll.UpdateUser(, this);
            this.Show();
            ////Update update = new Update(List parentWindow, ResearchDTO research);
            //update.Show();
        }
        public ArtworkUpdate(List parentWindow, ArtworkDTO artwork)
        {
            InitializeComponent();


            artworkDTO     = artwork;
            myParentWindow = parentWindow;

            txtTitle.Text   = artwork.Title;
            txtContent.Text = artwork.Content;
            txtMedium.Text  = artwork.Medium;
            txtYear.Text    = artwork.Year;
        }
Esempio n. 3
0
        public ActionResult <Artwork> PostArtwork(ArtworkDTO artwork)
        {
            Artwork artworkToCreate = new Artwork()
            {
                Name = artwork.Name, Artist = artwork.Artist
            };

            foreach (var t in artwork.Tags)
            {
                artworkToCreate.AddTag(new Tag(t.Name));
            }
            _artworkRepository.Add(artworkToCreate);
            _artworkRepository.SaveChanges();

            return(CreatedAtAction(nameof(GetArtwork), new { id = artworkToCreate.Id }, artworkToCreate));
        }
        private void btnDeactivate_Click(object sender, RoutedEventArgs e)
        {
            ArtworkDTO artworkDTO = ((FrameworkElement)sender).DataContext as ArtworkDTO;

            if (MessageBox.Show("Are you sure you want to deactivate " + artworkDTO.Title + " " + artworkDTO.Content + "?",
                                "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                var op = Artworkbll.Deactivate(artworkDTO.ArtistID);

                if (op.Code != "200")
                {
                    MessageBox.Show("Error : " + op.Message);
                }
                else
                {
                    MessageBox.Show("Artwork is successfully deactivated from table");
                    showData();
                }
            }
            ;
        }
Esempio n. 5
0
        public void AddItem(ArtworkDTO artworkDto)
        {
            var ArtworkDto = Mapper.Map <ArtworkDTO, Artwork>(artworkDto);

            Database.Artworks.Create(ArtworkDto);
        }