示例#1
0
        protected void idCheck_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(artId.Text);
            var db = new ModelTemaXPContainer();

            aw = db.Artworks.Find(id);
        }
示例#2
0
        public List <Artwork> GetArtworks()
        {
            List <Artwork> artworks = new List <Artwork>();

            using (var db = new ModelTemaXPContainer())
            {
                artworks = db.Artworks.ToList <Artwork>();
            }
            return(artworks);
        }
示例#3
0
        //Methods
        public void CreateArtwork(string nameOfArt, string nameOfArtist, string yearOfArt, double heightOfArt, double widthOfArt, string location, string urlOfImage)
        {
            Artwork aw = new Artwork()
            {
                name       = nameOfArt,
                artistName = nameOfArtist,
                year       = yearOfArt,
                height     = (heightOfArt),
                width      = (widthOfArt),
                location   = location,
                imageName  = urlOfImage
            };

            ModelTemaXPContainer db = new ModelTemaXPContainer();

            db.Artworks.Add(aw);
            db.SaveChanges();
        }
示例#4
0
        public void CreateAuction(float startBid, DateTime startDate, DateTime endDate, string itemText, int artId)
        {
            using (var db = new ModelTemaXPContainer())
            {
                Auction au = new Auction()
                {
                    startingBid = startBid,
                    startDate   = startDate,
                    endDate     = endDate,
                    itemText    = itemText,
                    Artwork     = db.Artworks.Find(1) //hardcoded id for testing purposes
                };

                //using (dbContext = new ModelTemaXPContainer()) ;
                db.Auctions.Add(au);
                db.SaveChanges();
            }
        }