public bool AddBid(Bid bid) { AmigosAuctionContext context = new AmigosAuctionContext(); context.Bids.Add(bid); return(context.SaveChanges() > 0); }
public bool LeaveComment(Comment comment) { context = new AmigosAuctionContext(); //Need to add EnityFramework from NuggetPackageManager context.Comments.Add(comment); return(context.SaveChanges() > 0); }
public void DeleteAuction(Auction auction) { context = new AmigosAuctionContext(); context.Entry(auction).State = System.Data.Entity.EntityState.Deleted; //context.Auctions.Remove(auction); context.SaveChanges(); }
public int SavePicture(Picture picture) { context = new AmigosAuctionContext(); //Need to add EnityFramework from NuggetPackageManager context.Pictures.Add(picture); context.SaveChanges(); return(picture.ID); }
//save public void SaveCategory(Category category) { try { context = new AmigosAuctionContext(); //Need to add EnityFramework from NuggetPackageManager context.Categories.Add(category); context.SaveChanges(); } catch (Exception e) { Console.Write(e.Message); } }
public void SaveAuction(Auction auction) { try { context = new AmigosAuctionContext(); //Need to add EnityFramework from NuggetPackageManager context.Auctions.Add(auction); context.SaveChanges(); } catch (Exception e) { Console.Write(e.Message); } }
//Delete public void DeleteCategory(Category category) { context = new AmigosAuctionContext(); context.Entry(category).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); }
public Category GetCategoryByID(int?id) { context = new AmigosAuctionContext(); return(context.Categories.Find(id)); }
//List all public List <Category> GetCategories() { context = new AmigosAuctionContext(); return(context.Categories.ToList()); }
public void UpdateAuction(Auction auction) { context = new AmigosAuctionContext(); context.Entry(auction).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); }
public Auction GetAuctionByID(int?ID) { context = new AmigosAuctionContext(); return(context.Auctions.Find(ID)); }
public List <Auction> GetAuctions() { context = new AmigosAuctionContext(); return(context.Auctions.ToList()); }
public List <Auction> GetFeaturedAuctions() { context = new AmigosAuctionContext(); return(context.Auctions.Take(4).ToList()); }
public List <Comment> GetComments(int entityID, int recordID) { context = new AmigosAuctionContext(); return(context.Comments.Where(x => x.EntityID == entityID && x.RecordID == recordID).ToList()); }