//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(); }
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(); } }