public void UpdateCategory(Category category) { BidOnContext context = new BidOnContext(); context.Entry(category).State = EntityState.Modified; context.SaveChanges(); }
public void SaveCategory(Category category) { BidOnContext context = new BidOnContext(); context.Categories.Add(category); context.SaveChanges(); }
public void SaveAuction(Auction auction) { BidOnContext context = new BidOnContext(); context.Auctions.Add(auction); context.SaveChanges(); }
public bool LeaveComment(Comment comment) { BidOnContext context = new BidOnContext(); context.Comments.Add(comment); return(context.SaveChanges() > 0); }
public void DeleteAuction(int Id) { BidOnContext context = new BidOnContext(); var deleteAuction = context.Auctions.Find(Id); context.Entry(deleteAuction).State = EntityState.Deleted; context.SaveChanges(); }
public bool AddBid(Bid bid) { BidOnContext context = new BidOnContext(); context.Bids.Add(bid); return(context.SaveChanges() > 0); }
public int SavePicture(Picture picture) { var context = new BidOnContext(); context.Pictures.Add(picture); context.SaveChanges(); return(picture.Id); }
public void DeleteCategory(int Id) { BidOnContext context = new BidOnContext(); var Deletecategory = context.Categories.Find(Id); context.Entry(Deletecategory).State = EntityState.Deleted; context.SaveChanges(); }
public void DeleteEntityComments(int entityId, int recordId) { BidOnContext context = new BidOnContext(); var auctioncomments = context.Comments.Where(c => c.EntityId == entityId && c.RecordId == recordId); foreach (var comment in auctioncomments) { context.Entry(comment).State = EntityState.Deleted; } context.SaveChanges(); }
public void UpdateAuction(Auction auction) { BidOnContext context = new BidOnContext(); var exitAuction = context.Auctions.Where(x => x.Id == auction.Id).Include(x => x.AuctionPictures).First(); context.AuctionPictures.RemoveRange(exitAuction.AuctionPictures); context.Entry(exitAuction).CurrentValues.SetValues(auction); context.AuctionPictures.AddRange(auction.AuctionPictures); context.SaveChanges(); }