public IActionResult BuyPainting(string paintingId)
        {
            User user = _users.FindUser(User.Identity.Name);

            Painting = _paintings.FindObject(paintingId);

            Painting.IsBought = true;

            if (user.Role != "Representative")
            {
                Painting.OwnerId          = user.Id;
                Painting.CurrentlyLocated = "Private Collection";
                Painting.OwnerName        = user.FirstName + " " + user.LastName;
            }
            else
            {
                Gallery                   = _galleries.Objects.Find(gal => gal.Title == user.Gallery);
                Painting.OwnerId          = Gallery.Id;
                Painting.CurrentlyLocated = "Art Gallery";
                Painting.OwnerName        = Gallery.Title;
            }

            _paintings.UpdateObject(Painting);

            return(RedirectToAction("SuccessfullyBought", "Auctions", new { @paintingID = paintingId }));
        }
Exemplo n.º 2
0
 public IActionResult DeleteArtist(string id)
 {
     Paintings = _paintings.GetArtistPaintings(id);
     foreach (var painting in Paintings)
     {
         if (!painting.IsBought)
         {
             _paintings.RemoveObject(painting.Id);
         }
         else
         {
             painting.ArtistId = null;
             _paintings.UpdateObject(painting);
         }
     }
     _artists.RemoveObject(id);
     return(RedirectToAction("Index"));
 }